Skip to content

chvmp/firmware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CHAMP Firmware

A lightweight implementation of CHAMP quadruped controller on Teensy series boards. This has been tested on Teensy 3.1, Teensy 3.6, and Teensy 4.0.

For this to work, you need to have a configuration package generated by the Setup Assistant that contains a pseudo URDF to help the controller understand the semantics of your robot during runtime.

If you don't have a physical robot yet and would want to get the controller running in simulation, you can use CHAMP's configuration package or the preconfigured robots found here.

1. Dependencies

Install PlatformIO

2. Linking your configuration package

Go to your configuration package folder and source the setup.bash. This helps the firmware to find the include path of the pseudo URDF generated by the setup assistant.

cd <your_package_configuration_folder>
source setup.bash

3. Configuring gait paremeters and hardware components

3.1 Gait Parameters

Gait paremeters can be configured in gait_config.h found in the configuration package.

cd <your_config_package>/include
nano gait_config.h

CHAMP Setup Assistant

  • Knee Orientation - How the knees should be bent. You can can configure the robot to follow the following orientation .>> .>< .<< .<> where dot is the front side of the robot.

  • Max Linear Velocity X (meters/second) - Robot's maximum forward/reverse speed.

  • Max Linear Velocity Y (meteres/second) - Robot's maximum speed when moving sideways.

  • Max Angular Velocity Z (radians/second)- Robot's maximum rotational speed.

  • Stance Duration (seconds)- How long should each leg spend on the ground while walking. You can set this to default(0.25) if you're not sure. The higher the stance duration the further the displacement is from the reference point.

  • Leg Swing Height (meters)- Trajectory height during swing phase.

  • Leg Stance Height (meters)- Trajectory depth during stance phase.

  • Robot Walking Height (meters) - Distance from hip to the ground while walking. Take note that setting this parameter too high can get your robot unstable.

  • CoM X Translation (meters) - You can use this parameter to move the reference point in the X axis. This is useful when you want to compensate for the weight if the center of mass is not in the middle of the robot (from front hip to rear hip). For instance, if you find that the robot is heavier at the back, you'll set a negative value to shift the reference point to the back.

  • Odometry Scaler - You can use this parameter as a multiplier to the calculated velocities for dead reckoning. This can be useful to compensate odometry errors on open-loop systems. Normally this value ranges from 1.0 to 1.20.

3.2 Hardware Configuration

Enabling the hardware components used in your build can be done in hardware_config.h found in the configuration package.

 cd <your_config_package>/include
nano hardware_config.h

The generated config file is in simulation mode by default so you don't have to configure anything if you just want to run in simulation.

4. Compiling

On the same terminal where you sourced the configuration package's bash file, run:

cd firmware
pio run -e <teensy_board>

where teensy_board can be:

  • teensy31
  • teensy36
  • teensy40

For example, compiling the code for Teensy 4.0 board will be:

pio run -e teensy40

5. Uploading the firmware

On the same terminal where you sourced the configuration package's bash file, run:

pio run --target upload -e <teensy_board>

6. Running in ROS

You can run the base controller by running:

roslaunch <your_config_package> bringup.launch rviz:=true lite:=true

The 'rviz' argument allows you to visualize the robot and debug the controller by using the foot's target position markers. This is set to false by default, so you don't need to pass this argument if there's no visualization required.

Don't forget to set the 'lite' argument to true as this tells the ROS package that you're using a lightweight version of the controller. You can permanently set this to true by editing bringup.launch found in your configuration package.

You can check out the ROS package to find out more about CHAMP's features.

Credits

Thanks to the following libraries: