OCS2 is a huge monorepo; DO NOT try to compile the whole repo. You only need to compile ocs2_legged_robot_ros and
its dependencies following the step below.
-
You are supposed to clone the OCS2, pinocchio, and hpp-fcl as described in the documentation of OCS2.
# Clone OCS2 git clone [email protected]:leggedrobotics/ocs2.git # Clone pinocchio git clone --recurse-submodules https://github.com/leggedrobotics/pinocchio.git # Clone hpp-fcl git clone --recurse-submodules https://github.com/leggedrobotics/hpp-fcl.git # Clone ocs2_robotic_assets git clone https://github.com/leggedrobotics/ocs2_robotic_assets.git # Install dependencies sudo apt install liburdfdom-dev liboctomap-dev libassimp-dev -
Compile the
ocs2_legged_robot_rospackage with catkin tools instead ofcatkin_make. It will take you about ten minutes.catkin config -DCMAKE_BUILD_TYPE=RelWithDebInfo catkin build ocs2_legged_robot_ros ocs2_self_collision_visualizationEnsure you can command the ANYmal as shown in the document and below.
Build the source code of legged_control by:
catkin build legged_controllers quake_description
Build the simulation
catkin build legged_gazebo
-
Set your robot type as an environment variable:
export ROBOT_TYPE=quake_without_arm source devel/setup.bash -
Run the simulation:
roslaunch legged_controllers one_start_gazebo.launch -
load the controller:
roslaunch legged_controllers load_controller.launch -
start the controller:
rostopic pub --once /load_controller std_msgs/Float32 "data: 1.23" -
Set the gait in the terminal of
load_controller.launchenter "list" in the terminal, then enter "trot"
-
Open another terminal, then enter rqt
-
Find the Robot Steering plugin and control the velocity of the robot in simulaiton. Note the topic name is
/cmd_vel -
You can enter "down" and "stance" in the terminal of
load_controller.launchto switch the control mode of the dog
