Motion-planning-based skills for Boston Dynamics' Spot robot
This repository includes others, such as spot_ros
, as nested submodules. To ensure that all submodules are cloned alongside this repository, use the command:
git clone --recurse-submodules https://github.com/Benned-H/spot_skills.git
If you have already cloned the repository, run the following command to ensure that all submodules are up-to-date:
sh scripts/git_pull_all.sh
This repository uses Docker to standardize its workspace across machines. Ignoring most of the details, you'll only need to know the following:
- To run the Spot skills code, you'll need to enter a Docker container, which has all the dependencies pre-installed.
- The exact Docker container you should enter depends on your local machine: Is it macOS or Ubuntu? Does it have NVIDIA?
Run the following script to select, launch, and then enter the appropriate container for your machine:
bash docker/launch.sh
To enter the running container in another terminal, just run the same script again.
Before launching the Spot driver, navigate to /docker/spot_skills
in the container, then run:
rosdep install -y --from-paths src --ignore-src --rosdistro noetic
pip3 install -e src/spot_ros/spot_wrapper/
Then, rebuild and source the Catkin workspace by running:
bash scripts/catkin_rebuild.sh
All demonstrations should be run from inside the Docker container. Unless otherwise
stated, you need to move to the top-level spot_skills
folder, build the workspace, and
source devel/setup.bash
. The commands to do this are:
# Assumes you're inside the Docker container
cd /docker/spot_skills
catkin build
source devel/setup.bash
If a demo requires a second or third terminal tab to be opened into Docker, that tab will need to move to the same directiory and source devel/setup.bash
.
# For a second, third, etc. terminal tab in Docker
cd /docker/spot_skills
source devel/setup.bash
In this real-world demonstration, Spot will use its arm to follow a 20-second trajectory. To run the demo, perform the following steps:
-
Use the tablet to teleoperate Spot to an open area free of obstacles. Make sure there's space in front of Spot for Spot's arm to fully extend.
-
Use the tablet to make Spot sit, which may be hidden under the Stand menu. Then, release tablet control of Spot by entering the Power Button menu (top of the screen), then tapping Advanced, and selecting Release Control.
- Check: Are Spot's front lights now flashing rainbow?
-
On your computer, make sure you've followed the Docker Demo Setup instructions above. We will need two terminal tabs to be opened into Docker.
-
We need to tell ROS which Spot we're using. Run the following command in the first tab, with
spot_name
substituted for the Spot you're using (e.g.,snouter
):
export SPOT_NAME=spot_name
- We're now ready to run the demo. In the first tab, run the command:
roslaunch spot_skills authenticate_spot_driver.launch spot_name:=$SPOT_NAME
That command will bring up RViz, which may initially show a bugged-out simulated Spot. Wait a bit until you see the Spot sitting as it is in the real world, something like:
- In the second terminal tab, run the following command (make sure to source
devel/setup.bash
first):
rosrun spot_skills arm_long_trajectory_demo.py
Spot should power on, stand up, deploy its arm, and begin executing the trajectory. Once the trajectory is complete, Spot should stow its arm, sit down, power off, and the demo driver will end by saying:
[INFO] [...]: Finished running the long joint trajectory.
In this demonstration, we use MoveIt to move Spot's arm left-and-right in a repeating path. The demo can be run in simulation (default) or on the real robot (work in progress).
Simulated Version - To run this demo in simulation, open a terminal into Docker and follow the Docker Demo Setup instructions above. Then, run the command:
roslaunch spot_skills moveit_spot_demo.launch
RViz should open, showing a simulated Spot. A target pose for Spot's end-effector should soon be displayed as RGB axes. As this target pose moves back-and-forth, MoveIt creates motion plans to the target, which are then used to control the simulated Spot's arm. An example screenshot from the demo is shown below.
Real Robot Version - To run this demo using a real robot, perform the following steps:
- Use the tablet to teleoperate Spot to an open area free of obstacles. Make sure there's space in front of Spot for Spot's arm to fully extend.
- Use the tablet to make Spot sit, which may be hidden under the Stand menu. Then,
release tablet control of Spot by entering the Power Button menu (top of the
screen), then tapping Advanced, and selecting Release Control.
- Check: Are Spot's front lights now flashing rainbow?
- On your computer, make sure you've followed the Docker Demo Setup instructions above. We will need two terminal tabs opened into Docker.
- We will need to tell ROS which Spot we're using. Note the name of the Spot robot you're using (e.g.,
snouter
). - Now, launch the real-robot demo using the following command, replacing
<SPOT-NAME>
with your Spot's name:
roslaunch spot_skills moveit_spot_demo.launch real_robot:=true spot_name:=<SPOT-NAME>
- In the second Docker terminal tab, source
devel/setup.bash
, and then run:
rosrun spot_skills spot_moveit_demo.py
In this demo, we visualize numerous randomly sampled put-down and grasping poses in RViz.
Note: This demo has been superseded by sampling code from a separate, TAMP-dedicated codebase. When the demo was working, it could be run using the commands:
pip install -r src/spot_skills/requirements.txt
source devel/setup.bash
roslaunch spot_skills sample_poses.launch
The Docker container will have handled the installation of any additional dependencies.
To launch spot_move_base
and rtabmap
, run the command:
roslaunch spot_move_base spot_navigation.launch
You can adjust the local planning in the following ways:
move_base
for global and local planning - Comment out the line saying<remap from="cmd_vel" to="/null/cmd_vel" />
inspot_move_base/launch/move_base.launch
. This sends velocities directly to Spot, which may produce jerky motion depending on the latency.move_base
for global planning and custom Spot local controller - Startspot_navigation.launch
, then run the following command:
rosrun spot_move_base send_traj.py
This node sends every 60th point in the global planner trajectory to /spot/go_to_pose
. This can be smoother than the move_base
method when using WiFi.
We need to compile rtabmap
using a special flag to support multiple cameras. Therefore, we have included rtabmap_ros
as a submodule of spot_skills
. The Docker's entrypoint script should have already installed the dependencies of rtabmap_ros
, so all we need to do is catkin build
with a special flag (source):
catkin build rtabmap_ros -DRTABMAP_SYNC_MULTI_RGBD=ON
You can change the minimum/maximum height of the point cloud by editing config/spot_cloud_filter.yaml
.