test

在这里插入图片描述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--;		
	}
}

}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值