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 ------- #. 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 [#ssh_troubleshooting]_ Enable SSH without password (super convenient!) [#ssh_without_password]_ #. Disable the stack from running on boot (one-time step):: sudo systemctl disable robot #. Set correct permissions (one-time step):: sudo chown -R pi /home/pi #. Modify code (see below for examples) #. Build code:: cd ~/pupperv3-monorepo/ros2_ws ./build.sh #. Launch stack:: ros2 launch neural_controller launch.py Examples ---------- Train a new RL policy ^^^^^^^^^^^^^^^^^^^^^^^^^^ #. Train a different policy using our colab `here `_. #. Download the resulting .json policy file from the Weights and Biases run generated by the colab and put it in ``neural_controller/launch`` #. Update the ``model_path`` field inside the config file located at ``neural_controller/launch/config.yaml`` to point to the new policy file. #. Build the code with ``./build.sh``. #. 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. #. Run the code on the physical hardware with ``ros2 launch neural_controller launch.py``. Add a new controller to control pupper movement ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #. Make a new ROS2 package in ``~/pupperv3-monorepo/ros2_ws/src``. #. Write a node that publishes `Twist `_ messages to the ``/cmd_vel`` topic. #. 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. #. Build the code with ``./build.sh``. #. 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. #. Run the code on the physical hardware with ``ros2 launch neural_controller launch.py``. .. rubric:: Footnotes .. [#ssh_troubleshooting] If you get an error saying there's already an entry for pupper.local with a different public key in your known_hosts file, run the following command to remove the entry ``ssh-keygen -R pupper.local`` .. [#ssh_without_password] You can SSH into Pupper without a password by following these steps. First `generate a SSH key `_. Then copy your computer's SSH key to Pupper ``ssh-copy-id -i ~/.ssh/id_ed25519.pub pi@pupper.local``