Modifying Pupper code

Source code

All of the software running on the Pi is available here: pupperv3-monorepo.

On the robot, the pupperv3-monorepo code is located at ~/pupperv3-monorepo.

The ROS2 workspace is located at ~/pupperv3-monorepo/ros2_ws.

Editing code on the robot

Steps

  1. SSH to Pupper with:

    ssh pi@pupper.local
    

    If you want to use Foxglove for visualization instead run:

    ssh -LA 8765:localhost:8765 pi@pupper.local
    

    Troubleshooting [1]

    Enable SSH without password (super convenient!) [2]

  2. Disable the stack from running on boot (one-time step):

    sudo systemctl disable robot
    
  3. Set correct permissions (one-time step):

    sudo chown -R pi /home/pi
    
  4. Modify code (see below for examples)

  5. Build code:

    cd ~/pupperv3-monorepo/ros2_ws
    ./build.sh
    
  6. Launch stack:

    ros2 launch neural_controller launch.py
    

Examples

Train a new RL policy

  1. Train a different policy using our colab here.

  2. Download the resulting .json policy file from the Weights and Biases run generated by the colab and put it in neural_controller/launch

  3. Update the model_path field inside the config file located at neural_controller/launch/config.yaml to point to the new policy file.

  4. Build the code with ./build.sh.

  5. Simulate your code with ros2 launch neural_controller launch.py sim:=True. A Mujoco simulation window should pop up on the screen or attached monitor.

  6. Run the code on the physical hardware with ros2 launch neural_controller launch.py.

Add a new controller to control pupper movement

  1. Make a new ROS2 package in ~/pupperv3-monorepo/ros2_ws/src.

  2. Write a node that publishes Twist messages to the /cmd_vel topic.

  3. Update the neural_controller/launch/launch.py file to include your new node and possibly disable the joystick twist publisher if the messages would conflict.

  4. Build the code with ./build.sh.

  5. Simulate your code with ros2 launch neural_controller launch.py sim:=True. A Mujoco simulation window should pop up on the screen or attached monitor.

  6. Run the code on the physical hardware with ros2 launch neural_controller launch.py.

Footnotes