Basic Environment Preparation
- Install the noetic version of ROS1 - Check whether
/opt/ros/noetic/setup.bashexists to verify that it is installed. - Create a new ROS1 workspace - Clone the kuavo repository under
~/catkin_ws/src:cd ~/catkin_ws && mkdir -p src && git clone https://gitee.com/leju-robot/kuavo_opensource.git kuavo - Build the project - In
~/catkin_ws, runsource ~/catkin_ws/devel/setup.bashand build withcatkin_make. If build errors occur, refer to the error messages. - Launch the robot master node - After a successful build, run
source ~/catkin_ws/devel/setup.bashand launch withroslaunch dynamic_biped highly_dynamic_robot.launch.
Required libraries
- geometry_msgs
1.1 Check whether the library is installed: rospack find geometry_msgs.
1.2 Install the library:
sudo apt-get update
sudo apt-get install ros-noetic-geometry-msgsTopics
/robot_head_motion_data
rostopic info /robot_head_motion_data
Output:
Type: dynamic_biped/robotHeadMotionData
Publishers:
* /HDrobot_node
Subscribers: None- Run the example to control the robot head motion; the robot head first rotates horizontally, then vertically.
source devel/setup.bash
python3 src/kuavo/ros_package/scripts/head_motion_control_demo.py -
Modify the
msg.joint_datadata insrc/kuavo/ros_package/scripts/head_motion_control_demo.pyyourself to control the direction of the robot head motion, and modify thetime.sleep()interval to control the speed of the robot head motion. -
The main program will receive the head joint data
[ INFO] [1712991040.763163738]: Received robot head motion data joint_data: [-20.000000, 0.000000]
[ INFO] [1712991040.863136754]: Received robot head motion data joint_data: [-17.000000, 0.000000]
[ INFO] [1712991040.963065995]: Received robot head motion data joint_data: [-14.000000, 0.000000]
[ INFO] [1712991041.063127669]: Received robot head motion data joint_data: [-11.000000, 0.000000]
[ INFO] [1712991041.163072952]: Received robot head motion data joint_data: [-8.000000, 0.000000]
[ INFO] [1712991041.263052537]: Received robot head motion data joint_data: [-5.000000, 0.000000]ROS Topic Details
- Topic name:
/robot_head_motion_data - MSG type:
dynamic_biped/robotHeadMotionData - MSG request:
float64[] joint_data - MSG description:
joint_data: head joint data, array length is 2joint_data[0]: yaw joint angle, range -30 to 30joint_data[1]: pitch joint angle, range -25 to 25
Notes
- Make sure you have already run
source devel/setup.bash. - Make sure the node is running in the correct ROS workspace.
- Make sure the relevant dependencies are installed.
/robot_hand_position
rostopic info /robot_hand_position
Output:
Type: dynamic_biped/robotHandPosition
Publishers:
* /HDrobot_node (http://rongman-ubuntu:46459/)
Subscribers: None- Run the example to receive the robot hand position information
source devel/setup.bash
python3 src/kuavo/ros_package/src/get_end_hand_demo.py
Output:
[INFO] [1712989416.423139]: left hand position: [80, 0, 0, 0, 0, 0]
[INFO] [1712989416.424122]: right hand position: [100, 0, 0, 0, 0, 0]
[INFO] [1712989417.423166]: left hand position: [80, 0, 0, 0, 0, 0]
[INFO] [1712989417.424141]: right hand position: [100, 0, 0, 0, 0, 0]
[INFO] [1712989418.423142]: left hand position: [80, 0, 0, 0, 0, 0]
[INFO] [1712989418.424029]: right hand position: [100, 0, 0, 0, 0, 0]- Use the ROS command-line tool
rostopic echo /robot_hand_position
Output:
left_hand_position: [0, 0, 0, 0, 0, 0]
right_hand_position: [0, 0, 0, 0, 0, 0]
---
left_hand_position: [0, 0, 0, 0, 0, 0]
right_hand_position: [0, 0, 0, 0, 0, 0]ROS Topic Details
- Topic name:
/robot_hand_position - MSG type:
dynamic_biped/robotHandPosition - MSG request:
uint8[] left_hand_position, uint8[] right_hand_position - MSG description:
left_hand_position:- For the left palm position, the array length is 6, corresponding to the thumb joint, thumb abductor, index finger joint, middle finger joint, ring finger joint, and little finger joint
- For the gripper position, left_hand_position[0] represents the gripper, and the other values are unused
right_hand_position:- For the right palm position, the array length is 6, corresponding to the thumb joint, thumb abductor, index finger joint, middle finger joint, ring finger joint, and little finger joint
- For the gripper position, right_hand_position[0] represents the gripper, and the other values are unused
- Position range: dexterous hand: 0-100, gripper: 0-255, where 0 is open and 255 is closed
Notes
- Make sure you have already run
source devel/setup.bash. - Make sure the node is running in the correct ROS workspace.
- Make sure the relevant dependencies are installed.
robot_q_v_tau
- Data format
float64[] q float64[] v float64[] tau - Description: The first 4 values of
qare the torso quaternion position;vandtaurepresent velocity and torque, respectively.
robot_torso_state
- Data format
geometry_msgs/Vector3 torsoR geometry_msgs/Vector3 torsoRd geometry_msgs/Vector3 torsoRdd geometry_msgs/Vector3 r geometry_msgs/Vector3 rd geometry_msgs/Vector3 rdd - Description: torsoR is the torso rotation angle, torsoRd is the torso rotation velocity, torsoRdd is the torso rotation acceleration.
- Description: r is the center-of-mass rotation angle, rd is the center-of-mass rotation velocity, rdd is the center-of-mass rotation acceleration.
kuavo_arm_traj
- Data format: Refer to sensor_msgs/JointState.
- Description: Controls the arm joint positions. Currently only the position information is used; velocity and torque are ignored.
kuavo_arm_target_poses
- Data format: Refer to std_msgs/Float64MultiArray.
- Description: Controls the arm target positions.
timesrepresents the time sequence,represents the positions of the arm and hand joints, and the position order is[left arm right arm left hand right hand]. For the arm position order, refer to topic\kuavo_arm_traj. For the finger position order, refer to topic\robot_hand_position.
walkCommand
- Data format
# mode: 0->PositionCommand | 1->VelocityCommand uint8 mode float64[] values - Description: Velocity control is recommended.
valuescontains the x and y axis velocities and the yaw angular velocity.
leju_robot_phase
Data format
- robotPhase.msg
uint8 mainPhase
uint8 subPhase- Description: mainPhase is the robot main state, subPhase is the robot sub-state.
robot_imu_gyro_acc
Data format
- robotImuGyroAcc.msg
geometry_msgs/Vector3 gyro
geometry_msgs/Vector3 acc- Description: gyro represents the angular velocity of the IMU, acc represents the acceleration of the IMU.
robot_head_motor_position
Data format
- robotHeadMotionData.msg
float64[] joint_data- MSG description:
joint_data: head joint data, array length is 2joint_data[0]: yaw joint angle,joint_data[1]: pitch joint angle
Services
setPhase
- Data format
uint8 masterID string stateReq string subState --- int16 stateRes - Description:
masterIDis usually 0;stateReqandsubStateare the main state and sub-state, respectively.
change_arm_ctrl_mode
- Data format
bool control_mode --- bool result - Description: While the robot is standing stably, set
control_modeto true to enable arm control mode.
update_center_of_mass_position Service Documentation
Service Overview
- Service name:
update_center_of_mass_position - Service type: custom service
- Request type:
geometry_msgs/Vector3positionfloat32timefloat32acc
- Response type:
boolsuccess
- Request type:
Service Description
This service is used to update or retrieve the position of the robot's center of mass. The client requests an update or retrieval by sending a geometry_msgs/Vector3 message containing the center-of-mass position. The service processes the request and returns a boolean success indicating whether the operation succeeded.
time is the execution time in seconds, acc is the execution acceleration in meters/second. When both are provided, time takes priority and time is used.
Usage Instructions
The client must send a request containing the center-of-mass position to the service endpoint to use this service. The service performs the corresponding operation, which is responsible for updating or retrieving the position of the robot's center of mass, and returns a boolean value indicating the result of the operation. It can only be used in standing mode.
Request Data Details
- position: a
geometry_msgs/Vector3message containing the center-of-mass position. Thexcomponent represents the position of the center of mass on the X axis, theycomponent represents the position on the Y axis, and thezcomponent represents the position on the Z axis. - time: the execution time in seconds. The default value is 0, which has no effect and lets interpolation be controlled by acceleration; if a time is set, the user-specified time is used for interpolation and acceleration is ignored.
- acc: the execution acceleration in meters/second². The default value is 0.5.
Response Data Details
- success: a boolean value;
trueindicates the operation succeeded,falseindicates it failed.
Example Usage
rosservice call /update_center_of_mass_position "position: {x: 0.0, y: 0.0, z: 0.6} time: 0.0 acc: 0.5"Make sure the service is correctly integrated into your ROS package, and that the necessary dependencies are properly defined in your package.xml and CMakeLists.txt files.
/get_center_of_mass_position Service Documentation
Service Overview
- Service name:
/get_center_of_mass_position - Service type: custom service, response type is
geometry_msgs/Vector3
Service Description
This service is used to return the position of the robot's center of mass (COM). The client obtains the geometry_msgs/Vector3 message containing the center-of-mass position by sending a request. The service processes the request and returns a geometry_msgs/Vector3 message containing the center-of-mass position.
Usage Instructions
The client must send a request to the service endpoint to use this service. The service processes the request and returns a geometry_msgs/Vector3 message containing the center-of-mass position.
Response Data Details
- com_value: a
geometry_msgs/Vector3message containing the center-of-mass position. Thexcomponent represents the position of the center of mass on the X axis, theycomponent represents the position on the Y axis, and thezcomponent represents the position on the Z axis.
Example Usage
rosservice call /get_center_of_mass_positionMake sure the service is correctly integrated into your ROS package, and that the necessary dependencies are properly defined in your package.xml and CMakeLists.txt files.
/control_jodell_claw_position Service Documentation
Service Overview
- Service name:
/control_jodell_claw_position - Service type:
uint left_claw_positionposition of the left claw,uint right_claw_positionposition of the right claw.
Service Description
This service is used to control the open/close position of the Jodell claw.
Usage Instructions
The client must send a request to the service endpoint to use this service; the service processes the request and returns the processing result {bool:result}.
Note: the open/close position range of the claw is [0, 255]
Response Data Details
- result: the execution result;
trueindicates success,falseindicates failure.
Example Usage
rosservice call /control_jodell_claw_position "{left_claw_position: 0, right_claw_position: 0}"
rosservice call /control_jodell_claw_position "{left_claw_position: 200, right_claw_position: 200}"Make sure the service is correctly integrated into your ROS package, and that the necessary dependencies are properly defined in your package.xml and CMakeLists.txt files.
Demo examples in the kuavo robot folder
The file structure is as follows
└── demo_action # 机器人动作演示案例
├── arm_move_X.py # 机械臂运动到指定位置-案例演示
├── arm_specific_actions.py # 机械臂特殊动作-案例演示
├── kuavoRobotSDK.py # 机器人控制基类
├── utils.py # 为arm_specific_actions.py提供moveit使用函数
├── walk_rectangle.py # 机器人正方形行走-案例演示
├── traj # 存放moveit预置好的不同动作的轨迹动作json文件
│ ├── Bowing # 作揖
│ ├── SayHello # 打招呼
│ └── Sending_flowers # 送花
└── ...update_new_demo...Launching the demo scripts
demo_action
- First make sure the
ros mastermaster node has been started - Make sure the robot node is launched; for how to launch the robot node with ROS, refer to the
control_nuc_ros1.mddocument in the same directory - Then go to the corresponding demo folder and source the corresponding devel environment via
source your_robot_workspace/devel/setup.bash
# 在demo/demo_action下
python3 arm_move_X.py # 机械臂运动到指定位置-案例演示
python3 arm_specific_actions.py # 机械臂特殊动作-案例演示
python3 walk_rectangle.py # 机器人正方形行走-案例演示