We’re excited to share another open-source project from the RAI Institute: spot_basic!
Working with Spot through ROS 2 can involve quite a bit of boilerplate, especially when interacting with the various topics, services, and actions exposed by the driver. spot_basic aims to make this easier by providing a higher-level, intuitive Python API for interacting with Spot’s capabilities.
Built on top of our spot_ros2 driver, spot_basic wraps the underlying ROS 2 interfaces into a consistent API that supports both synchronous and asynchronous programming. Some highlights include:
-
Simplified robot commands: Easily execute commands for locomotion, manipulation, gripper control, and more.
-
State and sensor access: Intuitive APIs for querying robot state, accessing transforms, and streaming camera data.
-
Synchronous and asynchronous execution: Write straightforward sequential code or run operations asynchronously.
-
Examples and extensibility: Includes runnable examples and guides for extending the API with new commands and actions.
For example, here’s a snippet that gets Spot up and walking forward:
from spatialmath import SE2
from spot_basic import SpotBasic
spot = SpotBasic("spot")
with spot.leash():
world_t_robot = spot.lookup_a_tform_b(
spot.vision_frame_name,
spot.body_frame_name
).yaw_SE2()
world_t_goal = world_t_robot * SE2(1.0, 0.0, 0.0)
spot.walk.synchronously(frame_t_goal=world_t_goal)
Check out the repository for installation instructions, documentation, and more examples:
Thanks to everyone who has contributed to this project including @hidmic @khughes1 @jbarry @taughz!
As always, feedback, bug reports, and contributions are welcome!
— The RAI Institute
Note: this works great with spatial-math!