Roban2 Docs
Roban2 (ROS1) Legacy VersionsFeature ExamplesGeneral Examples

Slope Interaction Example

Overview

The singleStepSlope.py script is built on the single-step control 6D interface. The controller uses command-line interaction and supports multiple gait modes, including upslope, downslope, turning, forward walking, and lateral movement, as well as preset complex action sequences.

Key Features

1. Basic Gait Control

  • Upslope: The robot walks up a slope
  • Downslope: The robot walks down a slope
  • Turn: The robot turns in place
  • Forward: The robot walks forward or backward
  • Strafe: The robot moves sideways to the left or right

2. Preset Sequences

  • Preset Sequence 1: Upslope → Forward → Downslope → Forward → Turn → Forward
  • Preset Sequence 2: Forward → Upslope → Downslope → Forward

Running Steps

  1. Start the robot
    cd ~/kuavo-ros-opensource
    catkin build humanoid_controllers
    source devel/setup.bash(或zsh)
    roslaunch humanoid_controllers load_kuavo_real.launch
  2. Run the controller:
    python3 ./src/humanoid_control/humanoid_controllers/singleStepSlope-roban.py
  3. Notes for real-robot use:

When running Preset 1, the first step is the upslope, so the robot must first be placed in front of the slope.

When running Preset 2, the forward walk is executed first. The forward distance is determined by the parameter PRESET_FIRST_FORWARD, currently set to 0.3 m; it can be adjusted as needed. Position the robot slightly farther back so that, after completing the forward walk, the front edge of its soles is about 1 cm from the bottom edge of the slope. This way, after walking up the slope, the robot ends up standing right at the top of the slope, reducing the chance of stepping on the edge.

Usage Instructions

Startup Interface

After startup, you will see the following menu:

==================================================
简化版6D步态控制器
==================================================
请选择要执行的功能:
┌──────────────────────────────────────────────┐
│ 1. 上斜坡 (slope)                    
│ 2. 下斜坡 (downslope)                
│ 3. 转身 (turn)                        
│ 4. 前走 (forward)                    
│ 5. 横走 (strafe)                     
│ 6. 预设1:  预设1: 上斜坡→前走→下斜坡→前走→转身→前走 
│ 7. 预设2: 前走→上斜坡→前走→下斜坡→前走    
│ 8. 退出 (quit)                        
└──────────────────────────────────────────────┘

Feature Details

1. Upslope (slope)

  • Function: The robot walks up a slope with a specified gradient
  • Parameters:
    • Distance: 0.9 m
    • Step length: 0.1 m
    • Slope angle: 9°
  • Characteristics: Automatically adjusts torso posture to adapt to the slope, calculates the number of steps based on the current distance and slope, and restores posture on the last step

2. Downslope (downslope)

  • Function: The robot walks down a slope with a specified gradient
  • Parameters: Same as upslope
  • Characteristics: Special handling for the first few steps to ensure stability

3. Turn (turn)

  • Function: The robot turns in place
  • Parameters: Customizable turning angle (default -180°)
  • Direction: Positive values turn left, negative values turn right

4. Forward Walk (forward)

  • Function: The robot walks forward or backward
  • Parameters: Customizable distance (default 0.2 m)
  • Characteristics: Negative values indicate backward movement

5. Strafe (strafe)

  • Function: The robot moves sideways to the left or right
  • Parameters: Customizable distance (default 0.0 m)
  • Direction: Positive values move left, negative values move right

6. Preset Sequences

  • Full preset: A complex sequence containing 6 actions
  • Simple preset: A simplified sequence containing 5 actions
  • Characteristics: Automatically handles foot switching between actions

Parameter Configuration

Default Parameters

SLOPE_FORWARD_DISTANCE = 0.9    # 斜坡前进距离
SLOPE_STEP_LENGTH = 0.10        # 斜坡步长
UP_SLOPE_ANGLE = 9.0           # 上斜坡角度
DOWN_SLOPE_ANGLE = 6.0         # 下斜坡角度,实物角度为9度,但下坡大角度会导致跺脚
TURN_ANGLE = -180.0            # 转身角度
PRESET_FIRST_FORWARD = 0.4     # 预设第一段前走距离
PRESET_MID_FORWARD = 0.1       # 预设中间前走距离
PRESET_LAST_FORWARD = 0.4      # 预设最后一段前走距离

Timing Parameters

walk_dt = 0.6          # 行走步态周期
walk_ss_time = 0.2     # 行走支撑相时间
slope_dt = 0.7         # 斜坡步态周期
slope_ss_time = 0.3    # 斜坡支撑相时间

Technical Implementation

Core Class: SimpleSlopeController

Main Methods

  1. plan_move_to_6d(): Plans a 6D movement trajectory
  2. plan_continuous_slope_movement(): Plans continuous slope movement
  3. plan_turn_movement(): Plans a turning trajectory
  4. plan_forward_movement(): Plans a forward trajectory
  5. publish_trajectory(): Publishes the trajectory to the ROS topic

Message Format

Published Topics

  • Topic name: /humanoid_mpc_foot_pose_6d_target_trajectories
  • Message type: kuavo_msgs/footPose6DTargetTrajectories

Message Contents

  • Time trajectory: Timestamps for each trajectory point
  • Foot index trajectory: Foot index at each time point
  • Foot pose trajectory: Sequence of 6D foot poses
  • Swing height trajectory: Height parameters for the swing phase