Skip to content

An fork of the quad_sdk repository used for generating simulated quadruped datasets.

License

Notifications You must be signed in to change notification settings

lunarlab-gatech/quad_sdk_fork

Repository files navigation

CircleCI Example image

Quad-SDK Fork

This is a fork of the Quad-SDK repository, used to generate simulated UniTree Go2 data for use with the MI-HGNN paper. For the main repository README.md or the documentation for how to use it, please see the original Quad-SDK repository.

However, we made some alterations to the setup process in order to resolve issues or streamline the process. See the sections below for alterations to the install process, the list of changes, and the updated usage to replicate our dataset collection process:

Install Alterations

Add the quad_sdk_message_synchronizer repository to your ROS workspace

You'll need to install the quad_sdk_message_synchronizer library to your workspace, as it takes all of the messages and combines them into a time-synchronized message. You can do this by downloading the repository into the src folder, and then building the ros workspace as normal.

Get HSL solver for IPOPT

On the "1. Getting Started with Quad SDK" page of the Quad-SDK Wiki, it mentions "Get HSL solver for IPOPT". However, you can't install the latest version of the solver, as it has build errors (see Issue #425). As of the time of writing, it's unclear whether this is solved, but we worked around it by getting the 2022.11.09 version of the solver.

Changelog

  • Enabled the "ma57" version of the HSL Solver for faster solving.
  • Slowed Simulation speed down to 1/5 of real-world speed in order to prevent dropped ROS messages.
  • The 'A1' robot is used by default instead of the 'Spirit' robot.
  • Update IMU ROS topic from '/trunk_imu' to '/state/imu'.
  • Set initialOrientationAsReference=false for IMU.
  • Fix bug causing contact sensor information not to be properly reported.
  • Increased the IMU update rate maximum to 1000 hz (which ends up being 750 hz in practice).
  • Wrote the Quad-SDK Message Synchronizer in order to synchronize the three messages that we need.
  • Logger now logs the ROS messages output from the Quad-SDK Message Synchronizer.
  • Fixed the teleop_twist_joy package so Joysticks can be used to control the robot.
  • Added Nintendo Switch Pro Controller Config file for Joystick input.

Updated Usage

Make sure to source the ROS Noetic install, and download the Quad-SDK Message Synchronizer into the same ROS workspace src folder as this repository, and then rebuild and re-source the ros workspace.

Launch the simulation with:

roslaunch quad_utils quad_gazebo.launch

Stand the robot with:

rostopic pub /robot_1/control/mode std_msgs/UInt8 "data: 1"

Controlling the robot

There are two options, either a user can control it directly, or use the global planner to control the robot for them.

To control the robot with keyboard input:

roslaunch quad_utils quad_plan.launch reference:=twist
rosrun teleop_twist_keyboard teleop_twist_keyboard.py cmd_vel:=/robot_1/cmd_vel

Or to control the robot with Joystick input:

roslaunch quad_utils quad_plan.launch reference:=twist
roslaunch teleop_twist_joy teleop.launch

To edit the speed that the joystick sends, see "external/teleop_twist_joy/config/pro_controller.config.yaml". Changing scale_linear and scale_angular changes the forward and turning speeds, respectively.

Or, to have the global planner drive the robot:

roslaunch quad_utils quad_plan.launch reference:=gbpl

Logging the dataset values

To log the dataset, run the following commands

python <ros_ws_path>/src/quad_sdk_message_synchronizer/scripts/pos_vel_body_frame.py
roslaunch quad_sdk_message_synchronizer synch_log_messages.launch
roslaunch quad_utils logging.launch

The timestamped file will be saved in the quad_logger/bags/archive/ folder.

The dataset values we are interested in (and that are logged) can be seen below:

Data Source Frame Units ROS Topic
Joint Position quad_simulator/gazebo_scripts/src/estimator_plugin.cpp N/A Radians /robot_1/state/ground_truth
Joint Velocity quad_simulator/gazebo_scripts/src/estimator_plugin.cpp N/A Radians/sec /robot_1/state/ground_truth
Joint Feedback Torque quad_simulator/gazebo_scripts/src/estimator_plugin.cpp N/A Newton-meters /robot_1/state/ground_truth
Linear Acceleration quad_simulator/go2_description/sdf_mesh/go2.sdf IMU Frame (Body Frame) Meters/(sec^2) /robot_1/state/imu
Angular Velocity quad_simulator/go2_description/sdf_mesh/go2.sdf IMU Frame (Body Frame) Radians/sec /robot_1/state/imu
Robot Position quad_simulator/gazebo_scripts/src/estimator_plugin.cpp World Frame Meters /robot_1/state/ground_truth
Robot Orientation quad_simulator/gazebo_scripts/src/estimator_plugin.cpp World Frame N/A (Quaternion) /robot_1/state/ground_truth
Foot Position quad_sdk_message_synchronizer/scripts/pos_vel_body_frame.py Body Frame Meters /foot_states
Foot Velocity quad_sdk_message_synchronizer/scripts/pos_vel_body_frame.py Body Frame Meters/sec /foot_states
Ground Reaction Forces quad_simulator/gazebo_scripts/src/contact_state_publisher.cpp World Frame Newtons /robot_1/state/grfs

Justification for Frames and Units

Gazebo uses ODE, and this link specifies that they use SI units (https://ode.org/wiki/index.php/FAQ#What_units_should_I_use_with_ODE.3F).

Joint Position:

Joint Velocity:

  • Assuming it uses the same units as Joint Position, and the SI units from ODE, this gives us Radians/sec.

Joint Feedback Torque:

Linear Acceleration / Angular Velocity:

Robot Position / Robot Orientation:

  • Calls a function called "WorldPose()".

Foot Position / Foot Velocity

Ground Reaction Forces:

Debugging

If you have any issues with the simulator, closing all terminal tabs and restarting has been found to resolve some problems.

Important Resources

These following websites have been useful for determining how Gazebo and Quad-SDK works:

Quad-SDK Tutorials

Gazebo Documentation

API (Version 11)

API (Unknown Version)

About

An fork of the quad_sdk repository used for generating simulated quadruped datasets.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published