精华内容
下载资源
问答
  • ![图片说明](https://img-ask.csdn.net/upload/202003/26/1585200824_828508.jpg) 图为6关节机器人DH模型图,这个模型的DH参数表应该怎么建立?
  • 用matlab文件描述了fanuc M10iA12的DH模型。每个关节都有一个单独的转换矩阵。
  • 我看了一些机器人的书,也看了一些别人写的研究生论文,发觉他们都是用激光跟踪仪测量机器人末端轨迹,然后通过微分方程或者雅克比矩阵建立误差模型,然后用最小二乘法的方法寻优求取各个关节的DH参数误差。...
  • 一.代码 不多说废话了,加了teach指令,运行了看一下就行。 clear; clc; %PUMA560模型 % theta d a alpha offset ML1=Link([0 0 0 0 0 ],'modified'); ML2=Link([0 ...

    一.模型
    这里写图片描述
    以****的六轴为例,我就直接放照片了,等以后有时间,我再画图。
    这里写图片描述
    DH模型:

    ii θi\theta_i did_i aia_i αi\alpha_i
    11 θ1\theta_1 00 0.1800.180 π2\frac{\pi}{2}
    22 θ2\theta_2 00 0.6000.600 00
    33 θ3\theta_3 00 0.1300.130 π2-\frac{\pi}{2}
    44 θ4\theta_4 0.6300.630 00 π2\frac{\pi}{2}
    55 θ5\theta_5 00 00 π2-\frac{\pi}{2}
    66 θ6\theta_6 0.10750.1075 00 00

    改进DH模型:
    这里写图片描述

    ii θi\theta_i did_i ai1a_{i-1} αi1\alpha_{i-1}
    11 θ1\theta_1 00 00 00
    22 θ2\theta_2 00 0.1800.180 π2-\frac{\pi}{2}
    33 θ3\theta_3 00 0.6000.600 0
    44 θ4\theta_4 0.6300.630 0.1300.130 π2-\frac{\pi}{2}
    55 θ5\theta_5 00 00 π2\frac{\pi}{2}
    66 θ6\theta_6 00 00 π2-\frac{\pi}{2}

    二.matlab代码

    clear;
    clc;
    %建立机器人模型
    %       theta    d           a        alpha     offset
    SL1=Link([0       0          0.180    -pi/2        0     ],'standard'); 
    SL2=Link([0       0          0.600     0           0     ],'standard');
    SL3=Link([0       0          0.130    -pi/2        0     ],'standard');
    SL4=Link([0       0.630       0        pi/2        0     ],'standard');
    SL5=Link([0       0           0       -pi/2        0     ],'standard');
    SL6=Link([0       0.1075      0        0           0     ],'standard');
    starobot=SerialLink([SL1 SL2 SL3 SL4 SL5 SL6],'name','Xinje-mod');
    figure(1),teach(starobot);
    %        theta    d           a        alpha     offset
    ML1=Link([0       0           0           0          0     ],'modified'); 
    ML2=Link([0       0           0.180      -pi/2       0     ],'modified');
    ML3=Link([0       0           0.600       0          0     ],'modified');
    ML4=Link([0       0.630       0.130      -pi/2       0     ],'modified');
    ML5=Link([0       0           0           pi/2       0     ],'modified');
    ML6=Link([0       0           0          -pi/2       0     ],'modified');
    modrobot=SerialLink([ML1 ML2 ML3 ML4 ML5 ML6],'name','Xinje-sta');
    figure(2),teach(modrobot);
    

    三.运行结果
    这里写图片描述
    可以看出末端位置,不完全一致,因为改进DH并没有建到工具坐标系,再乘一个纯平移的变换即可。
    四.将平移变换补进改进DH模型里

    clear;
    clc;
    %建立机器人模型
    %       theta    d           a        alpha     offset
    SL1=Link([0       0          0.180    -pi/2        0     ],'standard'); 
    SL2=Link([0       0          0.600     0           0     ],'standard');
    SL3=Link([0       0          0.130    -pi/2        0     ],'standard');
    SL4=Link([0       0.630       0        pi/2        0     ],'standard');
    SL5=Link([0       0           0       -pi/2        0     ],'standard');
    SL6=Link([0       0.1075      0        0           0     ],'standard');
    starobot=SerialLink([SL1 SL2 SL3 SL4 SL5 SL6],'name','Xinje-sta');
    figure(1),teach(starobot);
    %        theta    d           a        alpha     offset
    ML1=Link([0       0           0           0          0     ],'modified'); 
    ML2=Link([0       0           0.180      -pi/2       0     ],'modified');
    ML3=Link([0       0           0.600       0          0     ],'modified');
    ML4=Link([0       0.630       0.130      -pi/2       0     ],'modified');
    ML5=Link([0       0           0           pi/2       0     ],'modified');
    ML6=Link([0       0.1075      0          -pi/2       0     ],'modified');
    modrobot=SerialLink([ML1 ML2 ML3 ML4 ML5 ML6],'name','Xinje-mod');
    figure(2),teach(modrobot);
    

    这里写图片描述
    可见增加了一个平移变换后,末端位姿一致。
    五.DH与改进DH模型的区别
    将基坐标系表示为b,工具坐标系e,则工具坐标系到基坐标系的转换矩阵为:
    bT00T11T22T33T44T55T66Te=bTe{^bT_0}\cdot({^0T_1}\cdot{^1T_2}\cdot{^2T_3}\cdot{^3T_4}\cdot{^4T_5}\cdot{^5T_6})\cdot{^6T_e}={^bT_e}
    DH:DH:后置模型,将6系和e系,建立在一起。
    DH改进DH:前置模型,将0系和1系,建立在一起。
    因此,DH下表示的位姿,跟改进DH下的位姿,差了一个6Te{^6T_e}的变换,一般性都是一个纯平移。当然这个变换可以补偿到DH参数表中。
    PS:未完待续,会有更新。

    展开全文
  • 机器人标准DH模型建立方法-类比法 Puma560机器人标准DH参数表如下所示 Theta:关节转角 D:连杆偏移量 A:连杆长度 Alpha:连杆扭转角 theta d a alpha 1 q1 0.0000 0.0000 90 2 q2 0.0000 0.4318(a2) 0 3 q3 0.1500...

    机器人标准DH模型建立方法-类比法
    Puma560机器人标准DH参数表如下所示
    Theta:关节转角
    D:连杆偏移量
    A:连杆长度
    Alpha:连杆扭转角

     theta    d             a           alpha
    1    q1      0.0000        0.0000       90
    2    q2      0.0000        0.4318(a2)   0
    3    q3      0.1500(d3)    0.0203(a3)  -90
    4    q4      0.4318(d4)    0.0000       90
    5    q5      0.0000        0.0000      -90
    6    q6      0.0000        0.0000       0
    

    Puma560机器人模型如下图示
    在这里插入图片描述
    在这里插入图片描述

    参照puma560的机器人模型,观察Staubli TX90机器人模型,模型如下图示:
    在这里插入图片描述

    通过对比puma560机器人与Staubli机器人的类型相同,不同点在于staubli机器人的关节1的Z轴与关节2的Z轴有一个50mm的偏距,此偏距值为staubli机器人的a1;staubli机器人的关节3的Z轴与关节4的Z轴在同一平面内,而p560的关节4的Z轴相对于关节3的Z轴向上偏移了一个a3的距离,因此,staubli机器的d3值为0,而p560的a3值存在一个值。
    因此,可写出staubli机器人的标准DH参数表如下:

        theta    d             a           alpha
    1    q1      0.0000       -0.0500       90
    2    q2      0.0000        0.4250(a2)   0
    3    q3      0.0500(d3)    0.0000(a3)  -90
    4    q4      0.4250(d4)    0.0000       90
    5    q5      0.0000        0.0000      -90
    6    q6      0.0000        0.0000       0
    

    由上可得到DH参数表中变化的仅有,增加了a1值,取消了a3值,更改了a2,d3,d4的值。
    可用matlab中peter机器人工具箱所带的函数进行DH参数得到验证,得到staubli机器人模型如下图:
    在这里插入图片描述

    唯一有何实际情况不符合的示,matlab建立的机器人基坐标的的X方向与Y方向与实际的机器人基坐标系方向相反。但是此时的机器人关节转角状态是最符合实际机器人的状态。
    由此,再拿出一个机器人模型,我们可以直直接写出它的标准DH参数,下图示为Estun机器人,Estun机器人是国产机器人三大巨头之一,机器人整体性能较好,大家可以自己尝试着写一下;
    在这里插入图片描述

    展开全文
  • ur3.addSegment(Segment("joint1", Joint(Joint::RotZ), Frame::DH(1.85427703966640276e-05, M_PI / 2 + -0.000626175392884231741, 0.15190 + -5.56630992100959343e-05, -5.05343367106411137e-05)));...

    CMakeLists.txt

    cmake_minimum_required(VERSION 2.8)
    set(CMAKE_CXX_STANDARD 14)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    project(trac_ik_solver)
    find_package(orocos_KDL REQUIRED)
    find_package(Boost)
    include_directories(${Boost_INCLUDE_DIRS})
    link_directories(${Boost_LIBRARY_DIRS})
    #SET(ENV{PKG_CONFIG_PATH} /usr/lib/x86_64-linux-gnu/pkgconfig)
    #find_package(PkgConfig)
    #pkg_search_module(Boost REQUIRED)
    include_directories(${orocos_kdl_INCLUDE_DIRS})
    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
    file(GLOB SRCS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
    add_executable(${PROJECT_NAME} "main.cpp" ${SRCS})
    target_link_libraries(${PROJECT_NAME} ${orocos_kdl_LIBRARIES} nlopt  pthread ${Boost_LIBRARIES})
    
    

    main.cpp

    #include <iostream>
    #include <kdl/chain.hpp>
    #include <kdl/chainfksolverpos_recursive.hpp>
    #include <kdl/chainfksolvervel_recursive.hpp>
    #include <kdl/chainiksolverpos_lma.hpp>
    #include <kdl/chainiksolverpos_nr.hpp>
    #include <kdl/chainiksolverpos_nr_jl.hpp>
    #include <kdl/chainiksolvervel_pinv.hpp>
    #include <kdl/chainiksolvervel_pinv_givens.hpp>
    #include <kdl/chainiksolvervel_pinv_nso.hpp>
    #include <kdl/chainiksolvervel_pinv_nso.hpp>
    #include <kdl/chainiksolvervel_wdls.hpp>
    
    #include <kdl/chainjnttojacdotsolver.hpp>
    #include <kdl/chainjnttojacsolver.hpp>
    
    #include <kdl/chainidsolver_recursive_newton_euler.hpp>
    #include <kdl/chainfdsolver_recursive_newton_euler.hpp>
    
    
    #include <kdl/frames_io.hpp>
    #include <kdl/kinfam_io.hpp>
    
    #include <trac_ik/trac_ik.hpp>
    
    using namespace std;
    
    using namespace KDL;
    
    Chain get_ur3_robot() {
        Chain ur3;
        ur3.addSegment(Segment("base"));
        ur3.addSegment(Segment("joint1", Joint(Joint::RotZ),
                               Frame::DH(1.85427703966640276e-05, M_PI / 2 + -0.000626175392884231741, 0.15190 + -5.56630992100959343e-05, -5.05343367106411137e-05)));
        ur3.addSegment(Segment("joint2", Joint(Joint::RotZ),
                               Frame::DH(-0.24365 + 0.000418280909411400392, -0.00167062908967277168, 8.16504944596539062, -0.0561242156763783057)));
        ur3.addSegment(Segment("joint3", Joint(Joint::RotZ),
                               Frame::DH(-0.21325 + 0.001565903694771692, 0.00403522262881641277, -14.4282499666997612, -0.0628157016125706208)));
        ur3.addSegment(Segment("joint4", Joint(Joint::RotZ),
                               Frame::DH(-9.66540899511680791e-06, M_PI / 2 - 0.000368945620575544808, 0.11235 + 6.26317959859598705, 0.118814438034714087)));
        ur3.addSegment(Segment("joint5", Joint(Joint::RotZ),
                               Frame::DH(-2.93410449126249217e-05, -M_PI / 2 + 0.000173987342825920877, 0.08535 + -3.9946104585394937e-05, 5.68822754944051158e-05)));
        ur3.addSegment(Segment("tcp", Joint(Joint::RotZ),
                               Frame::DH(0.0, 0.0, 0.08190 + 0.000367523159254548593, -1.45429512938645578e-05)));
        return ur3;
    }
    
    int main() {
    //    Frame frame1 = Frame::DH(1.85427703966640276e-05, M_PI / 2 + - 0.000626175392884231741, 0.15190 + - 5.56630992100959343e-05, -5.05343367106411137e-05);
    //    Eigen::Vector3d v3d1;
    //    frame1.M.GetEulerZYX(v3d1[0], v3d1[1], v3d1[2]);
    //    std::cout << v3d1 << "\n";
    //    std::cout << frame1.p << "\n";
    //    Frame frame2 = Frame::DH(-0.24365 + 0.000418280909411400392, -0.00167062908967277168, 8.16504944596539062, -0.0561242156763783057);
    //    Eigen::Vector3d v3d2;
    //    frame2.M.GetEulerZYX(v3d2[0], v3d2[1], v3d2[2]);
    //    std::cout << v3d2 << "\n";
    //    std::cout << frame2.p << "\n";
    //    Frame frame3 = Frame::DH(-0.21325 + 0.001565903694771692, 0.00403522262881641277, -14.4282499666997612, -0.0628157016125706208);
    //    Eigen::Vector3d v3d3;
    //    frame3.M.GetEulerZYX(v3d3[0], v3d3[1], v3d3[2]);
    //    std::cout << v3d3 << "\n";
    //    std::cout << frame3.p << "\n";
    //    Frame frame4 = Frame::DH(-9.66540899511680791e-06, M_PI / 2 - 0.000368945620575544808, 0.11235 + 6.26317959859598705, 0.118814438034714087);
    //    Eigen::Vector3d v3d4;
    //    frame4.M.GetEulerZYX(v3d4[0], v3d4[1], v3d4[2]);
    //    std::cout << v3d4 << "\n";
    //    std::cout << frame4.p << "\n";
    //    Frame frame5 = Frame::DH(-2.93410449126249217e-05, -M_PI / 2 + 0.000173987342825920877, 0.08535 + -3.9946104585394937e-05, 5.68822754944051158e-05);
    //    Eigen::Vector3d v3d5;
    //    frame5.M.GetEulerZYX(v3d5[0], v3d5[1], v3d5[2]);
    //    std::cout << v3d5 << "\n";
    //    std::cout << frame5.p << "\n";
    //    Frame tcp = Frame::DH(0.0, 0.0, 0.08190 + 0.000367523159254548593, -1.45429512938645578e-05);
    //    Eigen::Vector3d v3tcp;
    //    tcp.M.GetEulerZYX(v3tcp[0], v3tcp[1], v3tcp[2]);
    //    std::cout << v3tcp << "\n";
    //    std::cout << tcp.p << "\n";
        //
        //
        //
        //    Vector v1(1, 2, 3);
    //    std::cout << v1 << "\n";
    //    v1.ReverseSign();
    //    std::cout << v1 << "\n";
        Chain ur3_robot = get_ur3_robot();
        ChainFkSolverPos_recursive fksolver(ur3_robot);
    //    JntArray q_init(ur3_robot.getNrOfJoints());
        JntArray q(ur3_robot.getNrOfJoints());
        Eigen::VectorXd joint_angles(6);
        joint_angles << 0, 0, 0, 0, 0, 0;
    //    joint_angles << 0.161429, -1.17692, 1.66764, -2.07981, -1.61873, 1.0;
    //    std::cout << q_init.data.setRandom() << "\n";
    //    q_init.data = q_init.data.setRandom() * M_PI;
    //    std::cout << joint_angles << "\n";
    //    joint_angles << 0.161429, -1.17692, 1.66764, -2.07981, -1.61873, 1.01775;
    //    q.data = joint_angles;
    //    std::cout << joint_angles << "\n";
        Frame T;
        fksolver.JntToCart(q, T);
        std::cout << T.p << "\n";
        Eigen::Vector3d zyx;
        T.M.GetEulerZYX(zyx[0], zyx[1], zyx[2]);
        std::cout << zyx.transpose() << "\n";
    //    //trac_ik_solver
    //    JntArray lower_joint_limits(ur3_robot.getNrOfJoints());
    //    joint_angles << -M_PI, -M_PI, -M_PI, -M_PI, -M_PI, -M_PI;
    //    lower_joint_limits.data = joint_angles;
    //    JntArray upper_joint_limits(ur3_robot.getNrOfJoints());
    //    joint_angles << M_PI, M_PI, M_PI, M_PI, M_PI, M_PI;
    //    upper_joint_limits.data = joint_angles;
    //    TRAC_IK::TRAC_IK ik_solver(ur3_robot, lower_joint_limits, upper_joint_limits, 0.005, 1e-10);
    //    JntArray result(ur3_robot.getNrOfJoints());
    //    if (ik_solver.CartToJnt(q_init, T, result) > 0) {
    //        std::cout << result << "\n";
    //    }
    //    //
    //    fksolver.JntToCart(result, T);
    //    std::cout << T << "\n";
    //    //
    //    Eigen::Vector3d rpy;
    //    T.M.GetRPY(rpy[0], rpy[1], rpy[2]);
    //    Eigen::Vector3d zyx;
    //    T.M.GetEulerZYX(zyx[0], zyx[1], zyx[2]);
    //    ChainIkSolverPos_LMA iksolver(ur3_robot);
    //    //kdl_ik_solver
    //    iksolver.CartToJnt(q_init, T, result);
    //    fksolver.JntToCart(result, T);
    //    std::cout << result << "\n";
    //    std::cout << T << "\n";
    //    ChainIkSolverVel_pinv viksolver(ur3_robot);
        std::cout << T.p << "\n";
        std::cout << T.M << "\n";
        std::cout << T.M.GetRot() << "\n"; //get robot's axis-angle presentation format
        return 0;
    }
    
    
    展开全文
  • // Joint::Ptr joint1 = ownedPtr(new RevoluteJoint("joint1", Transform3D<>::DH(M_PI / 2 + -0.000626175392884231741, 1.85427703966640276e-05, 0.15190 + -5.56630992100959343e-05, -5.05343367106411137e-...

    CMakeLists.txt

    cmake_minimum_required(VERSION 2.8)
    set(CMAKE_CXX_STANDARD 14)
    project(robwork_demo)
    #set(CMAKE_MODULE_PATH "")
    set(RobWork_DIR "/home/liuqiang/Documents/RobWork-master/RobWork/RobWork/cmake")
    find_package(RobWork)
    find_package(Eigen3 REQUIRED)
    include_directories(${ROBWORK_INCLUDE_DIRS})
    message(STATUS "ROBWORK_INCLUDE_DIRS: "${ROBWORK_INCLUDE_DIRS})
    link_directories(/home/liuqiang/Documents/RobWork-master/RobWork/RobWork/libs/relwithdebinfo)
    add_executable(${PROJECT_NAME} main2.cpp)
    message(STATUS "ROBWORK_LIBRARIES: " ${ROBWORK_LIBRARIES})
    target_link_libraries(${PROJECT_NAME} ${ROBWORK_LIBRARIES})
    
    

    main.cpp

    #include <rw/common.hpp>
    #include <rw/math.hpp>
    #include <rw/kinematics.hpp>
    #include <rw/models.hpp>
    
    #include <rw/kinematics/FixedFrame.hpp>
    #include <rw/models/SerialDevice.hpp>
    #include <rw/models/RevoluteJoint.hpp>
    #include <rw/kinematics/Kinematics.hpp>
    
    #include <iostream>
    using namespace rw::math;
    using namespace rw::models;
    using namespace rw::kinematics;
    using namespace rw::common;
    
    SerialDevice::Ptr getUR3Robot(StateStructure &state_structure) {
        Frame::Ptr base = ownedPtr(new FixedFrame("base", Transform3D<>::identity()));
        //Transform3D<>::DH();
        Joint::Ptr joint0 = ownedPtr(new RevoluteJoint("joint0", Transform3D<>::identity()));
    //    Joint::Ptr joint1 = ownedPtr(new RevoluteJoint("joint1", Transform3D<>::DH(-Pi / 2, 0, 0.140, 0)));
    //    Joint::Ptr joint2 = ownedPtr(new RevoluteJoint("joint2", Transform3D<>::DH(0, 0.270, 0, -Pi / 2)));
    //    Joint::Ptr joint3 = ownedPtr(new RevoluteJoint("joint3", Transform3D<>::DH(0, 0.256, 0, 0)));
    //    Joint::Ptr joint4 = ownedPtr(new RevoluteJoint("joint4", Transform3D<>::DH(Pi / 2, 0, 0.1035, Pi / 2)));
    //    Joint::Ptr joint5 = ownedPtr(new RevoluteJoint("joint5", Transform3D<>::DH(-Pi / 2, 0, 0.0980, -Pi / 2)));
    //    Frame::Ptr tcp = ownedPtr(new FixedFrame("tcp", Transform3D<>(Vector3D<>(0, 0, 0.0890))));
    //    Joint::Ptr joint1 = ownedPtr(new RevoluteJoint("joint1", Transform3D<>::DH(M_PI / 2 + -0.000626175392884231741, 1.85427703966640276e-05, 0.15190 + -5.56630992100959343e-05, -5.05343367106411137e-05)));
    //    Joint::Ptr joint2 = ownedPtr(new RevoluteJoint("joint2", Transform3D<>::DH(-0.00167062908967277168, -0.24365 + 0.000418280909411400392, 8.16504944596539062, -0.0561242156763783057)));
    //    Joint::Ptr joint3 = ownedPtr(new RevoluteJoint("joint3", Transform3D<>::DH(0.00403522262881641277, -0.21325 + 0.001565903694771692, -14.4282499666997612, -0.0628157016125706208)));
    //    Joint::Ptr joint4 = ownedPtr(new RevoluteJoint("joint4", Transform3D<>::DH(M_PI / 2 - 0.000368945620575544808, -9.66540899511680791e-06, 0.11235 + 6.26317959859598705, 0.118814438034714087)));
    //    Joint::Ptr joint5 = ownedPtr(new RevoluteJoint("joint5", Transform3D<>::DH(-M_PI / 2 + 0.000173987342825920877, -2.93410449126249217e-05, 0.08535 + -3.9946104585394937e-05, 5.68822754944051158e-05)));
    //    Frame::Ptr tcp = ownedPtr(new FixedFrame("tcp", Transform3D<>::DH(0.0, 0.0, 0.08190 + 0.000367523159254548593, -1.45429512938645578e-05)));
        Joint::Ptr joint1 = ownedPtr(new RevoluteJoint("joint1", Transform3D<>::DH(89.9641227927528 * Deg2Rad, 1.85427703966640276e-05, 0.15184433690079, -0.00289540421401276 * Deg2Rad)));
        Joint::Ptr joint2 = ownedPtr(new RevoluteJoint("joint2", Transform3D<>::DH(-0.0957199959700326 * Deg2Rad, -0.243231719090589, 8.16504944596539062, -3.21568068673845 * Deg2Rad)));
        Joint::Ptr joint3 = ownedPtr(new RevoluteJoint("joint3", Transform3D<>::DH(0.231201226026866 * Deg2Rad, -0.211684096305228, -14.4282499666997612, -3.59907458955342 * Deg2Rad)));
        Joint::Ptr joint4 = ownedPtr(new RevoluteJoint("joint4", Transform3D<>::DH(89.9788609730712 * Deg2Rad, -9.66540899511681e-06, 6.37552959859599, 6.80756584460776 * Deg2Rad)));
        Joint::Ptr joint5 = ownedPtr(new RevoluteJoint("joint5", Transform3D<>::DH(-89.9900312595674 * Deg2Rad, -2.93410449126249217e-05, 0.0853100538954146, 0.00325911431492984 * Deg2Rad)));
        Frame::Ptr tcp = ownedPtr(new FixedFrame("tcp", Transform3D<>::DH(0.0, 0.0, 0.08190 + 0.000367523159254548593, -1.45429512938645578e-05)));
    //    Joint::Ptr joint1 = ownedPtr(new RevoluteJoint("joint1",
    //                                 Transform3D<>(Vector3D<>(1.85428e-05, -9.37047e-10, 0.151844),
    //                                         RPY<>(-5.05343e-05, 0, 1.57017))));
    //    Joint::Ptr joint2 = ownedPtr(new RevoluteJoint("joint2",
    //                                 Transform3D<>(Vector3D<>(-0.242849, 0.013644, 8.16505),
    //                                         RPY<>( -0.0561242, 0, -0.00167063))));
    //    Joint::Ptr joint3 = ownedPtr(new RevoluteJoint("joint3",
    //                                 Transform3D<>(Vector3D<>(-0.211267, 0.0132883, -14.4282),
    //                                         RPY<>(-0.0628157, 0, 0.00403522))));
    //    Joint::Ptr joint4 = ownedPtr(new RevoluteJoint("joint4",
    //                                 Transform3D<>(Vector3D<>(-9.59727e-06, -1.14569e-06, 6.37553),
    //                                         RPY<>(0.118814, 0, 1.57043))));
    //    Joint::Ptr joint5 = ownedPtr(new RevoluteJoint("joint5",
    //                                 Transform3D<>(Vector3D<>(-2.9341e-05, -1.66899e-09,   0.0853101),
    //                                         RPY<>(5.68823e-05, 0, -1.57062))));
    //    Frame::Ptr tcp = ownedPtr(new FixedFrame("tcp", Transform3D<>(Vector3D<>(0, 0, 0.0822675), RPY<>(-1.4543e-05, 0, 0))));
        state_structure.addFrame(base);
        state_structure.addFrame(joint0, base);
        state_structure.addFrame(joint1, joint0);
        state_structure.addFrame(joint2, joint1);
        state_structure.addFrame(joint3, joint2);
        state_structure.addFrame(joint4, joint3);
        state_structure.addFrame(joint5, joint4);
        state_structure.addFrame(tcp, joint5);
        State state = state_structure.getDefaultState();
        const SerialDevice::Ptr device = ownedPtr(new SerialDevice(base.get(), tcp.get(), "ur3", state));
        std::pair<Q, Q> bounds;
        bounds.first = Q(6, -Pi, -Pi, -Pi, -Pi, -Pi, -Pi);
        bounds.second = Q(6, Pi, Pi, Pi, Pi, Pi, Pi);
        device->setBounds(bounds);
        return device;
    }
    int main() {
    //    EAA<> axis_angle(Vector3D<>(1.0, 0, 0), M_PI / 4);
    //    EAA<> axis_angle2(Vector3D<>(1.0, 0, 0), -M_PI / 4);
    //    std::cout << axis_angle << "\n";
    //    std::cout << axis_angle.toRotation3D() << "\n";
    //    std::cout << axis_angle2 << "\n";
    //    std::cout << axis_angle2.toRotation3D() << "\n";
    //    std::cout << EAA<>(axis_angle2.toRotation3D()) << "\n";
        StateStructure stateStructure;
        const SerialDevice::Ptr device = getUR3Robot(stateStructure);
        State state = stateStructure.getDefaultState();
        std::cout << device->getDOF() << "\n";
        Q q(6, 0, 0, 0, 0, 0, 0);
        device->setQ(q, state);
        auto frames = device->frames();
        std::cout << frames.size() << "\n";
    //    std::cout << Kinematics::frameTframe(frames.front(), frames.back(), state);
        for (auto frame : frames) {
            Transform3D<> trans = Kinematics::frameTframe(frame, frames.front(), state);
            std::cout << "Position: " << trans.P() << "\n";
            RPY<> rpy(trans.R());
            std::cout << "Attitude: " << rpy[0]*Rad2Deg << " " << rpy[1]*Rad2Deg << " " << rpy[2]*Rad2Deg << "\n";
            std::cout << "=====================================\n";
        }
    //    Transform3D<> tcp_pose = device->baseTend(state);
    //    std::cout << tcp_pose.P() << "\n";
    //    std::cout << RPY<>(tcp_pose.R()) << "\n";
        return 0;
    }
    
    
    展开全文
  • 六轴机器人matlab写运动学逆解函数(改进DH模型

    万次阅读 多人点赞 2018-06-23 17:04:53
    本文采用的模型为之前博客“matlab机器人工具箱一般六轴的DH模型和改进DH模型建立与区别”里面的改进DH模型,参数不再重复给出。 基系与工具坐标系关系为: bT0⋅(0T1⋅1T2⋅2T3⋅3T4⋅4T5⋅5T6)⋅6Te=bTebT0⋅...
  •    1、建立机器人模型   (1)Link类函数,基于DH法建模,建立其相关关系,DH法建模分改进型和标准型,Link类函数的一种用法是 R = Link([theta,d,a, alpha]),其中参数theta代表DH建模的关节角、参数d代表DH...
  • Matlab定义DH参数,建立机器人模型

    千次阅读 热门讨论 2020-11-24 21:23:53
    机器人坐标系建立
  • 六轴机器人matlab写运动学正解函数(DH模型

    万次阅读 多人点赞 2018-06-15 13:25:23
    1.分两个程序①主函数②function函数 2.main clear; clc; %建立机器人模型 % theta d a alpha offset SL1=Link([0 0 0.180 -pi/2 0 ],'standard'); SL2=Link([0 ...
  • 提出了采用D—H参截袁生成机器人三堆虚拟模型的方法,实现了机器人的可视 匕 仿真系统提供 的视图控制功能和场景漫游功能实现了多角度、多位置观测机器人模型的几何结构,并为机器人操 作人员提供了训练仿真平台 该...
  • 1.分两个程序①主函数②function函数 2.main clear; clc; %建立机器人模型 % theta d a alpha offset ML1=Link([0 0 0 0 0 ],'modified'); ML2=Link([0 0...
  • (一)手写正运动学函数(DH) (二)主函数 (三)代码解释 (四)易错点 手写正运动学函数(DH) %function T=zhengDHdaican(s,base_e,p,d,a,alpha,beta,tool_e) function T =zhengDHdaican(a1,a2,a3,d4,d6,theta1...

空空如也

空空如也

1 2 3 4 5 6
收藏数 119
精华内容 47
关键字:

机器人dh模型