ROS Group
Product Service
Official website
Technological exchanges
ROS Tourials
Deep Learning
Computer Vision

xiaoqiang tutorial (22) Operating 6 DOF robotic arm

  • Xiaoqiang Homepage

    6 degrees of freedom robot arm resources. Please read the serial communication protocol of the secondary development part in the resources. Although the following is the usb hid communication method, the command format is the same.

    The following will operate the 6-DOF arm to complete the 3 sets of actions stored on the main control board.

    Control principle: Xiaoqiang host uses the usb to connect the robot master control board, user sends a topic named robot_arm/cmdstring, this topic content is the control command, and the robot_arm node is responsible for sending the topic content to the master control board of the robot arm via USB protocol.

    1. Run the robot_arm node

    rosrun robot_arm

    If the result is normal, the robot arm will perform action 0 (the default state), and the command window will show the following

    xiaoqiang@xiaoqiang-desktop:~/Documents/ros$ rosrun robot_arm 
    Opening robot arm device
    Manufacturer: MyUSB_HID
    Product: LOBOT
    Serial No: 8D9823654852
    Run the zero group action

    2. Construct robot_arm/cmdstring topic

    robot_arm/cmdstring This topic type is std_msg/String. According to the secondary development data of the robot arm provided above, we can know that the 6-DOF control protocol is represented by an unsigned byte array. Therefore, we slightly modify it here to directly convert the hex value of this array into a string. Packaged into the topic command. The transformation method uses the byte array representation of python to string together the hex encodings of each element in the array, and then replace 0x with \x

    # E.g: [0x55,0x55,0x05,0x06,0x00,0x01,0x00] This control command array, converted to robot_arm/cmdstring content is '\x55\x55\x05\x06\x00\x01\x00'
    # Tip: If you don't understand it, you can use Python's map function to help convert it.

    We want to control the robot arm to complete 3 actions. The contents of these three strings are as follows:


    3. Publish motion commands

    Open a new terminal, because it is a demonstration, so we directly using the pub function of rostopic, the above string command packaged into a topic sent to the robot_arm node

    # Action 1:
    rostopic pub robot_arm/cmdstring std_msgs/String '\x55\x55\x05\x06\x00\x01\x00'
    # Action 2:
    rostopic pub robot_arm/cmdstring std_msgs/String '\x55\x55\x05\x06\x01\x01\x00'
    # Action 3:
    rostopic pub robot_arm/cmdstring std_msgs/String '\x55\x55\x05\x06\x02\x01\x00'

    4. There is no video for the sport result, you need to operate it yourself. If you feel unsatisfactory with the movement, please refer to our servo control posts: 电机控制与缓动函数

    Xiaoqiang Homepage
    Back To Index

Log in to reply