Kuavo Docs
Feature ExamplesGeneral Examples

H12 Remote Controller Usage Development Case

1. Deployment Process

  1. Run the deployment script

    ⚠️ Note: The h12pro remote controller program, the robot program, and the VR program all use the ROS_MASTER_URI and ROS_IP configured at deployment time. Please make sure the ROS_MASTER_URI and ROS_IP are correct at deployment time. Confirm that ROS master-slave communication is correct before deploying.

    1.1 Lower-level computer deployment

    cd /home/lab/kuavo-ros-opensource
    cd /home/lab/kuavo-ros-opensource/src/humanoid-control/h12pro_controller_node/scripts
    sudo su
    ./deploy_autostart.sh

    After execution, dependencies are installed automatically and the h12pro remote controller program is started.

    1.2 Upper-level computer deployment

    cd ~/kuavo_ros_application
    cd ~/kuavo_ros_application/src/ros_audio/kuavo_audio_player/scripts
    ./deploy_autostart_h12pro.sh

    After execution, the packages are compiled automatically, and the service that plays voice actions triggered by the H12 remote controller is set to start on boot and then started. Choose y or n as prompted in the terminal.

  2. H12PRO remote controller service management

  • The ocs2_h12pro_monitor service is located on the lower-level computer and integrates the remote controller node and monitoring functions. It automatically manages starting and stopping the remote controller program according to system state. When the user manually starts the robot program, the h12pro remote controller program goes offline automatically.

    Start the service:

    sudo systemctl start ocs2_h12pro_monitor.service

    Stop the service:

    sudo systemctl stop ocs2_h12pro_monitor.service

    Restart the service:

    sudo systemctl restart ocs2_h12pro_monitor.service

    Enable on boot:

    sudo systemctl enable ocs2_h12pro_monitor.service

    Disable on boot:

    sudo systemctl disable ocs2_h12pro_monitor.service

    View service logs:

    sudo journalctl -u ocs2_h12pro_monitor.service -f
  • The start_h12pro_play_node service is located on the upper-level computer. It sets the services related to voice playback triggered by the H12 remote controller to start on boot.

  1. View the robot program run log
sudo su
tmux attach -t humanoid_robot
  1. Check whether the remote controller data is normal
cd /home/lab/kuavo-ros-opensource
source devel/setup.bash
rostopic echo /h12pro_channel
  1. Notes
  • Because the ocs2_h12pro_monitor service has a relatively low priority, if the user manually starts the roslaunch humanoid_controllers load_kuavo_real.launch program, the ocs2_h12pro_node program will go offline automatically, and it will only come back online automatically after the user terminates the robot program.
  • It is possible that after the user terminates the robot program, ocs2_h12pro_node still does not come online or does not respond. In this case, first run pkill ros or sudo pkill ros to terminate all ros processes, then restart the sudo systemctl restart ocs2_h12pro_monitor.service service.
  • If you use an external module for the remote controller (a USB device connected to the remote controller receiver) to receive remote controller data, plug the external module into the robot approximately 20-30 seconds after the robot is powered on.
  • If the remote controller data cannot be received normally after restarting the robot NUC, hot-plug the external module and try again.

2. State Machine Overview

  1. Basic states
  • initial: Initial state (robot NUC powered on, program not started)
  • calibrate: Calibration state (robot program started with calibration parameters)
  • ready_stance: Ready stance (robot program started, not yet standing)
  • stance: Standing posture
  • walk: Walk state
  • vr_remote_control: VR remote controller control state
  1. State transition diagram

    robot_state_graph

  • Source indicates the current robot state, i.e. the start point of the line segment in the figure above
  • Trigger indicates the state transition trigger, i.e. the text on the line segment in the figure above
  • Dest indicates the target robot state, i.e. the end point of the arrow in the figure above

The state transitions are as follows:

  • From the initial state:

    • initial_pre -> ready_stance
    • calibrate -> calibrate
  • From the ready_stance state:

    • ready_stance -> stance
    • stop -> initial
  • From the stance state:

    • walk -> walk
    • arm_pose1/2/3/4 -> stance (arm posture control)
    • customize_action_RR/LL_A/B/C/D -> stance (play voice and action)
    • stop -> initial
    • start_vr_remote_control -> vr_remote_control
  • From the walk state:

    • stance -> stance
    • stop -> initial
  • From the vr_remote_control state:

    • stop_vr_remote_control -> stance
    • stop -> initial
    • record_vr_rosbag -> vr_remote_control
    • stop_record_vr_rosbag -> vr_remote_control

3. Remote Controller Configuration

  1. Button diagram

    button_instruction

  2. Key combinations for state transitions

  • Initial (robot NUC powered on, program not started) state transitions
Target stateKey combinationSwitch position
ready_stanceC_PRESSE_LEFT + F_RIGHT
  • Ready_stance (robot program started, not yet standing) state transitions
Target stateKey combinationSwitch position
stanceC_PRESSE_LEFT + F_RIGHT
initialC_LONG_PRESS + D_LONG_PRESSAny
  • Calibrate (robot program started with calibration parameters) state transitions
Target stateKey combinationSwitch position
initialC_LONG_PRESS + D_LONG_PRESSAny
  • Stance state transitions
Target stateKey combinationSwitch position
walkA_PRESSE_MIDDLE + F_MIDDLE
arm_pose1A_PRESSE_RIGHT + F_LEFT
arm_pose2B_PRESSE_RIGHT + F_LEFT
arm_pose3C_PRESSE_RIGHT + F_LEFT
arm_pose4D_PRESSE_RIGHT + F_LEFT
customize_action_RR_AA_PRESSE_RIGHT + F_RIGHT
customize_action_RR_BB_PRESSE_RIGHT + F_RIGHT
customize_action_RR_CC_PRESSE_RIGHT + F_RIGHT
customize_action_RR_DD_PRESSE_RIGHT + F_RIGHT
customize_action_LL_AA_PRESSE_LEFT + F_LEFT
customize_action_LL_BB_PRESSE_LEFT + F_LEFT
customize_action_LL_CC_PRESSE_LEFT + F_LEFT
customize_action_LL_DD_PRESSE_LEFT + F_LEFT
start_vr_remote_controlA_LONG_PRESSAny
initialC_LONG_PRESS + D_LONG_PRESSAny
toggle_head_controlB_PRESSE_MIDDLE + F_RIGHT
  • Walk state transitions
Target stateKey combinationSwitch position
stanceD_PRESSE_MIDDLE + F_MIDDLE
initialC_LONG_PRESS + D_LONG_PRESSAny
  • VR_remote_control state transitions
Target stateKey combinationSwitch position
stanceB_LONG_PRESSAny
initialC_LONG_PRESS + D_LONG_PRESSAny
record_vr_rosbagC_PRESSAny
stop_record_vr_rosbagD_PRESSAny

NOTE

  • In the remote controller key combinations, long press (LONG_PRESS) means keeping the key pressed after pressing it until the remote controller emits a beep.
  • In the Stance state, the four arm_pose target states only support playing custom actions. The action files are stored under /home/lab/.config/lejuconfig/action_files, with the file names arm_pose1.tact, arm_pose2.tact, arm_pose3.tact, arm_pose4.tact.
  • If the arm does not return to its initial position after an arm action is completed, you can return the arm to its initial position with the E_MIDDLE + F_MIDDLE + D keys.
  • In the Stance state, the eight customize_action target states support playing custom voice and actions. You need to modify the arm_pose_name action file name (without extension) and the music_name audio file name (with extension) for the corresponding target state in the configuration file at /home/lab/kuavo-ros-opensource/src/humanoid-control/h12pro_controller_node/config/customize_config.json on the lower-level computer.
  • If the upper-level computer is WNUC12WSKI70000, place the corresponding audio files in the folder /home/kuavo/.config/lejuconfig/music on the upper-level computer.
  • If the upper-level computer is AGX-Orin/ORIN-NX, place the corresponding audio files in the folder /home/lab/.config/lejuconfig/music on the lower-level computer.
  • Place .tact action files in the folder /home/lab/.config/lejuconfig/action_files on the lower-level computer.
  • If you need to use the remote controller to execute a python program, you can modify /home/lab/kuavo-ros-opensource/src/humanoid-control/h12pro_controller_node/config/customize_config.json as follows:
  "customize_action_LL_A": {
    "type": "shell",
    "command": "python3 /home/lab/.../~.py"
  },
  • After completing the above operations, you need to power off and restart the robot.
  • After entering the VR teleoperation state, the remote controller will no longer respond to key combinations (except the emergency stop combination and the combination for exiting VR teleoperation) until the VR teleoperation state is exited.
  • VR-recorded rosbag files are stored under ~/.log/vr_remote_control/rosbag, named by date and time.
  • The configuration file for the topics recorded by VR is stored at /home/lab/kuavo-ros-opensource/src/humanoid-control/h12pro_controller_node/config/record_topics.json.
  • The specified topics to record are as follows:
    • /kuavo_arm_traj # arm joint values

    • /control_robot_hand_position # fingers

    • /robot_head_motion_data # head

    • Depth camera

      • /camera/depth/image_rect_raw # depth camera image
      • /camera/depth/camera_info # depth camera intrinsics (calibrated at the realsense factory)
      • /camera/depth/color/points # RGB point cloud with depth (Point2D)
    • RGB camera

      • /camera/color/image_raw # RGB camera image
      • /camera/color/camera_info # RGB camera intrinsics (calibrated at the realsense factory)
    • Depth aligned to RGB camera

      • /camera/aligned_depth_to_color/image_raw # depth image after alignment to RGB
      • /camera/aligned_depth_to_color/camera_info # camera intrinsics after alignment to RGB
  1. Joystick configuration
  • The joysticks are supported in the following states:

    • stance
    • walk
  • Left joystick

    • Vertical direction: X-axis movement
    • Horizontal direction: Y-axis movement
  • Right joystick

    • Vertical direction: torso height control
    • Horizontal direction: rotation control
  • Emergency stop

    • Key combination: C_LONG_PRESS + D_LONG_PRESS
    • Applicable states: all states (except the initial state)
    • If stop is triggered in the standing state, the robot will squat down first and then stop