This repository provides ROS support for the Cyton Robot. The recommend operating environment is on Ubuntu 14.04 with ROS Indigo. So far These packages haven't been tested in other environment.
Install some important dependent software packages:
$ sudo apt-get install ros-indigo-dynamixel-motor ros-indigo-gazebo-ros-control
Install or upgrade MoveIt!. If you have installed MoveIt!, please make sure that it's been upgraded to the latest version.
Install MoveIt!:
$ sudo apt-get install ros-indigo-moveit
$ sudo apt-get install ros-indigo-moveit-full-pr2
$ sudo apt-get install ros-indigo-moveit-kinematics
$ sudo apt-get install ros-indigo-moveit-ros-move-group
Upgrade MoveIt!:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install ros-indigo-moveit-kinematics
$ sudo apt-get install ros-indigo-moveit-ros-move-group
Install this repository from Source
First set up a catkin workspace (see this tutorials).
Then clone the repository into the src/ folder. It should look like /path/to/your/catkin_workspace/src/cyton_robot.
Make sure to source the correct setup file according to your workspace hierarchy, then use catkin_make to compile.
Assuming your catkin workspace folder is ~/catkin_ws, you should use the following commands:
$ cd ~/catkin_ws/src
$ git clone https://github.com/Hans-Cyton/cyton_robot.git
$ cd ..
$ catkin_make
$ source devel/setup.bash
Bring up the simulated robot in Gazebo:
$ roslaunch cyton_model gazebo.launch
Start up RViz with a configuration including the MoveIt! Motion Planning plugin:
$ roslaunch cyton_moveit_config moveit_planning_execution.launch
Tutorial about how to use MoveIt! RViz plugin: docs/moveit_plugin_tutorial_english.md
Tips: Every time you want to plan a trajectory, you should set the start state to current first.
For the teleoperation with keyboard, run:
$ rosrun cyton_teleop cyton_teleop_keyboard
For the teleoperation with joystick, run:
$ roslaunch cyton_moveit_config joystick_control.launch
Tutorial about joystick control teleoperation:
http://docs.ros.org/indigo/api/moveit_tutorials/html/doc/ros_visualization/joystick.html
Tips:
- In the Motion Planning plugin of Rviz, enable “Allow External Comm.” checkbox in the “Planning” tab.
- Add “Pose” to rviz Displays and subscribe to /joy_pose in order to see the output from joystick. Note that only planning groups that have IK solvers for all their End Effector parent groups will work.
Connect Cyton to the computer with a usb cable. You can see the usb device ID(s) with the following command.
$ ls /dev/ttyUSB*
If there are more than one usb devices, you should confirm the ID(s) of the other device(s) before you connect Cyton to the computer. In this case you can find out the device ID of Cyton. The default ID is /dev/ttyUSB0. If your device ID is not /dev/ttyUSB0, you should correct the following line in the file cyton_bringup/launch/cyton_dxl_bringup.launch or cyton_bringup/launch/cyton_xqtor_bringup.launch
port_name: "/dev/ttyUSB0"
Assuming the device ID is /dev/ttyUSB0, bring up the real robot according to the servo brand
If you are using dynamixel servos, run:
$ sudo chmod 777 /dev/ttyUSB0
$ roslaunch cyton_bringup cyton_dxl_bringup.launch
If you are using Han's xQtor servos, run:
$ sudo chmod 777 /dev/ttyUSB0
$ roslaunch cyton_bringup cyton_xqtor_bringup.launch
Make the robot go to home position:
$ rosservice call /cyton_go_home "data: true"
or
$ rosservice call /cyton_go_home "data: false"
# for this command "data: false" and "data: true" are the same
Start up RViz with a configuration including the MoveIt! Motion Planning plugin:
$ roslaunch cyton_moveit_config moveit_planning_execution.launch
Tutorial about how to use MoveIt! RViz plugin: docs/moveit_plugin_tutorial_english.md
Tips: Every time you want to plan a trajectory, you should set the start state to current first.
For the teleoperation with keyboard, run:
$ rosrun cyton_teleop cyton_teleop_keyboard
For the teleoperation with joystick, run:
$ roslaunch cyton_moveit_config joystick_control.launch
Tutorial about joystick control teleoperation:
http://docs.ros.org/indigo/api/moveit_tutorials/html/doc/ros_visualization/joystick.html
Tips:
- In the Motion Planning plugin of Rviz, enable “Allow External Comm.” checkbox in the “Planning” tab.
- Add “Pose” to rviz Displays and subscribe to /joy_pose in order to see the output from joystick. Note that only planning groups that have IK solvers for all their End Effector parent groups will work.
Before turning the robot off, you can use the following command to set torque disenable. At this time you should protect the robot from falling down.
$ rosservice call /cyton_torque_enable "data: false"
# "data: false" : disenable
# "data: true": enable