Turtlebot Arm

From KameRider
Jump to: navigation, search


  • before user can control the arm, user need to set the ID of the servos of the arm.
  • different commands will be sent to the servos based on their ID number.
  • to set the ID of the servos, please refer this website: Servo ID Set Up
  • at the end of the website above, user should be able to control the arm movement via GUI.
  • then, how can user control the arm without using the GUI?
  • in our case, the position of arm was predefined, and specific position values for different servos of the arm are needed.
  • first, user need to adjust the gesture of the arm manually before open the GUI, after the gesture is fixed, user can open the GUI and acquire servos positions from its topic.
  • there are many topics which the GUI published, however if user only wants to know the values of servos positions, user need to look at the /joint_states topic.
  • in this topic, all servos positions are recorded.
  • user just need to record down the values and then publish those values into the correct topics. Turtlebot arm will move to that specific gesture next time user initiate the arm.
  • for an example:
    • if user want to set the position of servo at gripper joint, then the position value need to be publish to topic named /gripper_joint/command.
  • the value of servo position is in the unit of radian.
  • An example of source code with explanation:

include section:

1 # Include message type needed by servo's position
2 from std_msgs.msg import Float64

initiation section:

1 # Assume user has an arm with 2 servos with name arm_wrist and gripper_joint
2 # Their ID number is 1 and 2 respectively.
3 # Initiate publishers
4 self.joint1 = rospy.Publisher('/arm_wrist/command',Float64)
5 self.joint2 = rospy.Publisher('/gripper_joint/command',Float64)
7 # User generated variables which is type Float64.
8 self.pos1 = Float64()
9 self.pos2 = Float64()

main (loop) section:

 1     # Set both servos position at 0 degree
 2     self.pos1 = 0.00
 3     self.pos2 = 0.00
 4     self.joint1.publish(self.pos1)
 5     self.joint2.publish(self.pos2)
 7     # Give 2 seconds to the arm to respond
 8     rospy.sleep(2)
10     # Set first servo at 45 degree, second servo at 90 degree
11     self.pos1 = 0.785
12     self.pos2 = 1.57
13     self.joint1.publish(self.pos1)
14     self.joint2.publish(self.pos2)
16     # Give 2 seconds to the arm to respond
17     rospy.sleep(2)
  • source code of the above example can be found here: [1]
  • source code of integration of arm with buttons can be found here: [2]


  • the method to control the Crane+ arm is similar to the method of controlling BIOLOID Turtlebot arm.
  • the difference is that there is no GUI for Crane+ arm.
  • after user has manually set the gesture of the Crane+ arm, user need to access the following topic to identify the servo position value:
    • rostopic echo /motor_states/PORT_NAME
  • if user is not sure about the topic's name, user may use the following command to check the topic published:
    • rostopic list
  • in this case, same package can be used for both arm.