Master repo for implementing Whole Body Control on the Stanford Pupper
> git clone [email protected]:makeller1/PupperWholeBodyControl.git
Note: You will need an SSH key on your GitHub profile. See: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
The catkin workspace is used to compile the C++ code
- Create folder for catkin workspace e.g. WBC_catkin_ws
- Add new folder called src e.g. WBC_catkin_ws/src
- In a terminal enter:
sudo apt update sudo apt install python3-catkin-tools cd WBC_catkin_ws catkin build
- Move repo code to WBC_catkin_ws/src
- Run one more time:
catkin build
- Source the catkin workspace by adding the following line to ~/.bashrc (hidden file in your home directory)
source /home/user/WBC_catkin_ws/devel/setup.bash # Allows ros to find the specific executable inside the package
Assuming you have the ros distro noetic,
sudo apt install ros-noetic-gazebo-ros
- Open a terminal and navigate to ~/WBC_catkin_ws/src/PupperWholeBodyControl/workstation/plugins
- Create a folder called build
mkdir build
- Run
cd build catkin build #build library containing PupperWBC.cpp and PupperModel.cpp cmake .. make -j
- Build the WBC C++ code using the steps above
- Add the following line to your .bashrc (or run in the current shell)
# Point gazebo to plugin path export GAZEBO_PLUGIN_PATH=~/WBC_catkin_ws/src/PupperWholeBodyControl/workstation/plugins/build
- Open a terminal and run
roslaunch workstation load_pupper.launch
- Start ros by opening a terminal and running:
roscore
- Start the ros node (communication between C++ code and Python code) by running:
rosrun workstation PupperNode
- If you don't have a physical ethernet adapter (common on laptops), create a virtual one. This is required to communicate with the keyboard controller interface.
cd ~/WBC_catkin_ws/src/PupperWholeBodyControl/workstation/src/PythonComms bash create_dummy_ethernet
- Run keyboard controller:
cd ~/WBC_catkin_ws/src/PupperWholeBodyControl/workstation/src/PythonComms/KeyboardController python3 keyboard_joystick.py
- Start the python code that communicates with the keyboard controller, C++ code, and the pupper. Open a new terminal and enter:
cd ~/WBC_catkin_ws/src/PupperWholeBodyControl/workstation/src/PythonComms python3 run_djipupper.py
Note: the order of these steps is important.
- Open VS code
- Install the PlatformIO extension
- Open the PlatformIO tab and select "Open"
- Select "Add Existing"
- Navigate to the folder src/onboard
- Select Open "onboard"
- In the PlatformIO tab, select Project Tasks> teensy40 > Build
The pupper is zeroed at initialization of run_djipupper.py.
- Start run_djipupper.py and wait for prompt "Press enter to ZERO MOTORS".
- Lay pupper flat with elbows and knees back (all feet pointing forward)
- Rotate hips to raise legs
- Rotate elbows to raise feet off the ground
- Rotate hips to lower the legs until the end of the motors touch the ground
- Rotate elbows to lower feet until they touch the ground (the motors should be rubbing against the ground at this point)
- Press enter. If performed correctly, repeatability is < 1 deg
The Pupper URDF is generated with the xacro urdf macro. It is composed of four files:
- pupper.urdf.xacro
- right_leg.xacro
- left_leg.xacro
- motor.xacro
Modifications to any of these files do not take place until compiled as follows:
- Open a terminal and navigate to ~/WBC_catkin_ws/src/PupperWholeBodyControl/workstation/pupper_description
- Run
rosrun xacro xacro pupper.urdf.xacro > pupper.urdf