Running the Real Robot - SAR-Research-Lab/R2ED_humanoid GitHub Wiki
So far we have been able to connect to the robot arm using ros_canopen and control it via Moveit. The following steps enable that functionality:
- Setup your can device
- After USB - CAN device is plugged into the computer make sure you have can0 in /dev
- Execute these commands to setup can0
$ sudo ip link set dev can0 down
$ sudo ip link set can0 type can bitrate 500000
$ sudo ip link set dev can0 up
$ sudo ifconfig can0 txqueuelen 20
- Run the ros drivers
cd ~/catkin_ws
source devel/setup.bash
roslaunch schunk_lwa4p_svh robot.launch
The last command should persist in your terminal. If it has an error, you have issues with your installation
To start the connection: rosservice call /arm/driver/init
You should see
success: True
message: ''
- Launch MoveIt!
roslaunch lwa4p_svh_moveit_config moveit_planning_execution.launch
To run the real robot WITHOUT MoveIt!:
Caution! the robot can move very quickly and damage you and your possessions. Be careful.
- Setup your can device
- After USB - CAN device is plugged into the computer make sure you have can0 in /dev
- Execute these commands to setup can0
$ sudo ip link set dev can0 down
$ sudo ip link set can0 type can bitrate 500000
$ sudo ip link set dev can0 up
$ sudo ifconfig can0 txqueuelen 20
- Run the ros drivers
cd ~/catkin_ws
source devel/setup.bash
roslaunch schunk_lwa4p_svh robot.launch
The last command should persist in your terminal. If it has an error, you have issues with your installation
To start the connection: rosservice call /arm/driver/init
You should see
success: True
message: ''
This will launch the can connection to the robot and a joint_trajectory_controller interface which will allow you to control the joint states individually by publishing a message to this topic: /arm/joint_trajectory_controller/command
To test this out on the command line execute this command:
rostopic pub /arm/joint_trajectory_controller/command trajectory_msgs/JointTrajectory "header:
seq: 0
stamp:
secs: 0
nsecs: 0
frame_id: ''
joint_names: [arm_1_joint, arm_2_joint, arm_3_joint, arm_4_joint, arm_5_joint, arm_6_joint]
points:
- positions: [0.18, 0, 0, 0, 0, 0]
time_from_start: {secs: 1, nsecs: 0}"
This will set all the joints to 0 radians except the first joint. Careful as the robot can move very quickly when executing this command. The robot will have its arm pointed straight outward so make sure there are no objects or people (even its own body) obstructing its path