Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Spot SDK from 4.0.2 to 4.1.0 #495

Merged
merged 12 commits into from
Oct 17, 2024
Merged
27 changes: 15 additions & 12 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,31 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update -q && \

RUN source "/opt/ros/${ROS_DISTRO}/setup.bash"

ARG SPOT_SDK_VERSION="4.1.0"
ARG SPOT_MSG_VERSION="${SPOT_SDK_VERSION}-4"

# Install bosdyn_msgs package
mhidalgo-bdai marked this conversation as resolved.
Show resolved Hide resolved
RUN curl -sL https://github.com/bdaiinstitute/bosdyn_msgs/releases/download/4.0.2/ros-humble-bosdyn_msgs_4.0.2-jammy_amd64.run --output /tmp/ros-humble-bosdyn_msgs_4.0.2-jammy_amd64.run --silent \
&& chmod +x /tmp/ros-humble-bosdyn_msgs_4.0.2-jammy_amd64.run \
&& ((yes || true) | /tmp/ros-humble-bosdyn_msgs_4.0.2-jammy_amd64.run) \
&& rm /tmp/ros-humble-bosdyn_msgs_4.0.2-jammy_amd64.run
RUN curl -sL https://github.com/bdaiinstitute/bosdyn_msgs/releases/download/${SPOT_MSG_VERSION}/ros-humble-bosdyn_msgs_${SPOT_MSG_VERSION}-jammy_amd64.run --output /tmp/ros-humble-bosdyn_msgs_${SPOT_MSG_VERSION}-jammy_amd64.run --silent \
&& chmod +x /tmp/ros-humble-bosdyn_msgs_${SPOT_MSG_VERSION}-jammy_amd64.run \
&& ((yes || true) | /tmp/ros-humble-bosdyn_msgs_${SPOT_MSG_VERSION}-jammy_amd64.run) \
&& rm /tmp/ros-humble-bosdyn_msgs_${SPOT_MSG_VERSION}-jammy_amd64.run

# Install spot_cpp_sdk package
RUN curl -sL https://github.com/bdaiinstitute/spot-cpp-sdk/releases/download/v4.0.2/spot-cpp-sdk_4.0.2_amd64.deb --output /tmp/spot-cpp-sdk_4.0.2_amd64.deb --silent \
&& dpkg -i /tmp/spot-cpp-sdk_4.0.2_amd64.deb \
&& rm /tmp/spot-cpp-sdk_4.0.2_amd64.deb
RUN curl -sL https://github.com/bdaiinstitute/spot-cpp-sdk/releases/download/v${SPOT_SDK_VERSION}/spot-cpp-sdk_${SPOT_SDK_VERSION}_amd64.deb --output /tmp/spot-cpp-sdk_${SPOT_SDK_VERSION}_amd64.deb --silent \
&& dpkg -i /tmp/spot-cpp-sdk_${SPOT_SDK_VERSION}_amd64.deb \
&& rm /tmp/spot-cpp-sdk_${SPOT_SDK_VERSION}_amd64.deb

# Install bosdyn_msgs missing dependencies
RUN python -m pip install --no-cache-dir --upgrade pip==22.3.1 \
&& pip install --root-user-action=ignore --no-cache-dir --default-timeout=900 \
numpy==1.24.1 \
pytest-cov==4.1.0 \
pytest-xdist==3.5.0 \
bosdyn-api==4.0.2 \
bosdyn-core==4.0.2 \
bosdyn-client==4.0.2 \
bosdyn-mission==4.0.2 \
bosdyn-choreography-client==4.0.2 \
bosdyn-api==${SPOT_SDK_VERSION} \
bosdyn-core==${SPOT_SDK_VERSION} \
bosdyn-client==${SPOT_SDK_VERSION} \
bosdyn-mission==${SPOT_SDK_VERSION} \
bosdyn-choreography-client==${SPOT_SDK_VERSION} \
pip cache purge

# Install spot_wrapper requirements
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ jobs:
strategy:
matrix:
config:
- { python: "3.8" }
- { python: "3.9" }
- { python: "3.10" }
steps:
- name: Checkout repository
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src="spot.png" width="350">
<h1 align="center">Spot ROS 2 Driver</h1>
<p align="center">
<img src="https://img.shields.io/badge/python-3.8|3.9|3.10-blue"/>
<img src="https://img.shields.io/badge/python-3.10-blue"/>
<a href="https://github.com/astral-sh/ruff">
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json"/>
</a>
Expand All @@ -23,7 +23,7 @@

# Overview
This is a ROS 2 package for Boston Dynamics' Spot. The package contains all necessary topics, services and actions to teleoperate or navigate Spot.
This package is derived from this [ROS 1 package](https://github.com/heuristicus/spot_ros). This package currently corresponds to version 4.0.2 of the [spot-sdk](https://github.com/boston-dynamics/spot-sdk/releases/tag/v4.0.2).
This package is derived from this [ROS 1 package](https://github.com/heuristicus/spot_ros). This package currently corresponds to version 4.1.0 of the [spot-sdk](https://github.com/boston-dynamics/spot-sdk/releases/tag/v4.1.0).

## Prerequisites
This package is tested for Ubuntu 22.04 and ROS 2 Humble, which can be installed following [this guide](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html).
Expand Down
4 changes: 2 additions & 2 deletions install_spot_ros2.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARCH="amd64"
SDK_VERSION="4.0.2"
MSG_VERSION="${SDK_VERSION}"
SDK_VERSION="4.1.0"
MSG_VERSION="${SDK_VERSION}-4"
ROS_DISTRO=humble
HELP=$'--arm64: Installs ARM64 version'
REQUIREMENTS_FILE=spot_wrapper/requirements.txt
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ exclude = [
]
line-length = 120
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
target-version = "py38"
target-version = "py310"

[tool.ruff.per-file-ignores]
"__init__.py" = ["F401"]
Expand All @@ -39,7 +39,7 @@ max-complexity = 10

[tool.black]
line-length = 120
target-version = ['py38']
target-version = ['py310']
include = '\.pyi?$'
force-exclude = '''
/(
Expand All @@ -48,7 +48,7 @@ force-exclude = '''
preview = true

[tool.mypy]
python_version = "3.8"
python_version = "3.10"
disallow_untyped_defs = true
ignore_missing_imports = true
explicit_package_bases = true
Expand Down
11 changes: 6 additions & 5 deletions spot_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.22)

list(APPEND CMAKE_PREFIX_PATH /opt/spot-cpp-sdk)

Comment on lines -3 to -4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is also in the spot_ros2_control cmake and probably could also be removed if it's not needed anymore

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 93d3b30.

project(spot_driver)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Expand All @@ -18,6 +16,7 @@ endif()

set(THIS_PACKAGE_INCLUDE_ROS_DEPENDS
bosdyn_api_msgs
bosdyn_cmake_module
bosdyn_spot_api_msgs
cv_bridge
geometry_msgs
Expand All @@ -36,12 +35,14 @@ set(THIS_PACKAGE_INCLUDE_ROS_DEPENDS

find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(bosdyn REQUIRED)
find_package(OpenCV 4 REQUIRED)

foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_ROS_DEPENDS})
find_package(${Dependency} REQUIRED)
endforeach()

find_package(bosdyn REQUIRED)
find_package(OpenCV 4 REQUIRED)

###
# Spot API
###
Expand Down Expand Up @@ -85,7 +86,7 @@ target_include_directories(spot_api PUBLIC
$<INSTALL_INTERFACE:include>
)

target_link_libraries(spot_api PUBLIC bosdyn::bosdyn_client_static)
target_link_libraries(spot_api PUBLIC bosdyn::bosdyn_client)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this same change also needed for the ros2 control package?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Done in 93d3b30.

set_property(TARGET spot_api PROPERTY POSITION_INDEPENDENT_CODE ON)
ament_target_dependencies(spot_api PUBLIC ${THIS_PACKAGE_INCLUDE_ROS_DEPENDS})

Expand Down
15 changes: 10 additions & 5 deletions spot_ros2_control/hardware/src/spot_hardware_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,10 @@ bool SpotHardware::start_command_stream() {
return false;
}

joint_cmd->mutable_gains()->mutable_k_q_p()->Assign(kp.begin(), kp.end());
joint_cmd->mutable_gains()->mutable_k_qd_p()->Assign(kd.begin(), kd.end());
joint_cmd->mutable_gains()->mutable_k_q_p()->Clear();
joint_cmd->mutable_gains()->mutable_k_q_p()->Add(kp.begin(), kp.end());
joint_cmd->mutable_gains()->mutable_k_qd_p()->Clear();
joint_cmd->mutable_gains()->mutable_k_qd_p()->Add(kd.begin(), kd.end());

// Let it extrapolate the command a little
joint_cmd->mutable_extrapolation_duration()->CopyFrom(
Expand Down Expand Up @@ -518,9 +520,12 @@ void SpotHardware::send_command(const JointStates& joint_commands) {
// build protobuf
auto* joint_cmd = joint_request_.mutable_joint_command();

joint_cmd->mutable_position()->Assign(position.begin(), position.end());
joint_cmd->mutable_velocity()->Assign(velocity.begin(), velocity.end());
joint_cmd->mutable_load()->Assign(load.begin(), load.end());
joint_cmd->mutable_position()->Clear();
joint_cmd->mutable_position()->Add(position.begin(), position.end());
joint_cmd->mutable_velocity()->Clear();
joint_cmd->mutable_velocity()->Add(velocity.begin(), velocity.end());
joint_cmd->mutable_load()->Clear();
joint_cmd->mutable_load()->Add(load.begin(), load.end());

if (endpoint_ == nullptr) {
auto endpoint_result = robot_->StartTimeSyncAndGetEndpoint();
Expand Down
2 changes: 1 addition & 1 deletion spot_wrapper
Loading