test

it2022-05-05  104

1,给串口开权限 sudo chmod 777 /dev/ttyUSB0 ls -all tty*

2,运行rosserial_python rosrun rosserial_python serial_node.py _port:=/dev/ttyUSB0 _baud:=115200

3,打开rqt console rosrun rqt_console rqt_console

4,打开串口监听 sudo cutecom

5,查看topic rostopic echo 消息名称

6,运行仿真 roslaunch testbot_description testbot.launch

7,运行轨迹规划 roslaunch testbot_description_moveit_config demo.launch

8,发布joint_states 消息 rostopic pub -1 /joint_states sensor_msgs/JointState ‘{header: auto, name: [‘joint1’,‘joint2’,‘joint3’,‘joint4’,‘left_gippper_joint’,‘right_gripper_joint’], position: [0.171, 0.0,-1.55,0.0,0.0,0.0], velocity: [], effort: []}’

编译open_manipulator的步骤如下:

$ sudo apt-get install ros-kinetic-ros-controllers ros-kinetic-gazebo* ros-kinetic-moveit* ros-kinetic-industrial-core

$ cd ~/catkin_ws/src/ $ git clone https://github.com/ROBOTIS-GIT/DynamixelSDK.git $ git clone https://github.com/ROBOTIS-GIT/dynamixel-workbench.git $ git clone https://github.com/ROBOTIS-GIT/dynamixel-workbench-msgs.git $ git clone https://github.com/ROBOTIS-GIT/open_manipulator.git $ git clone https://github.com/ROBOTIS-GIT/open_manipulator_msgs.git $ git clone https://github.com/ROBOTIS-GIT/open_manipulator_simulations.git $ git clone https://github.com/ROBOTIS-GIT/robotis_manipulator.git $ cd ~/catkin_ws && catkin_make


header: seq: 135 stamp: secs: 1566464542 nsecs: 796565055 frame_id: ‘’ name: [joint1, joint2, joint3, joint4, left_gripper_joint, right_gripper_joint] position: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] velocity: [] effort: []

void on_time(){ for(int i = 0;i ❤️;i++)} if(axis[i].currentPos == axis[i].nextPos){ axis[i].count = 0; //标记对应的轴队列弹出第一个索引,下次调用进来时再取队列新的第一个索引值。 axis[i] = ;//队列的第一项 continue; } axis[i].count++; if(axis[i].count % axis[i].speed == 0){ int distance = (axis[i].nextPos - axis[i].currentPos); if(axis[i].type == RIGHT || axis[i].type == CENTER){//左右电机 X控制大臂 if(distance < 0){ setPosition(type,HIGH); //设置dir高电平,例正转 }else if(distance > 0){ setPosition(type,LOW); //设置dir为低电平,例反转 }else{ return; } }else{//底座电机和y控制小臂 if(distance > 0){//如果差值是正数就正传反之反转 setPosition(type,HIGH); //设置dir高电平,例正转 }else if(distance < 0){ setPosition(type,LOW); //设置dir为低电平,例反转 }else{ return; } }

setValue(axis[i].type,HIGH); //设置step为高电平 delayMicroseconds(velocity); // 延时微秒。 setValue(axis[i].type,LOW); // 设置step为低电平 delayMicroseconds(velocity); // 延时微妙。 distance > 0 ? axis[i].currentPos++ : axis[i].currentPos--; } }

}


最新回复(0)