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

Upgrade to Drake 1.28 #340

Merged
merged 16 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/bazelized_drake_ros.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ jobs:
run: |
sudo apt install python3 python3-toposort
sudo rm -rf /var/lib/apt/lists/*
- name: Use GCC 11, until GCC 13 works with drake's clang
run: sudo apt purge gcc-13 libgcc-13-dev g++-13 libstdc++-13-dev gcc-12 libgcc-12-dev g++-12 libstdc++-12-dev && sudo apt install gcc-11 g++-11 && sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11
working-directory: drake_ros
- name: Download Drake
run: bazel build @drake//:module_py
working-directory: drake_ros
Expand Down
7 changes: 3 additions & 4 deletions bazel_ros2_rules/ros2/resources/templates/prologue.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# -*- python -*-
# vi: set ft=python :

package(default_visibility = ["//visibility:public"])

load("//tools:common.bzl", "interfaces_filegroup")
load("//tools:common.bzl", "share_filegroup")
load("//tools:common.bzl", "interfaces_filegroup", "share_filegroup")
load(":ros_py.bzl", "ros_import_binary")

package(default_visibility = ["//visibility:public"])

exports_files(["system-rosdep-keys.txt"])
10 changes: 5 additions & 5 deletions bazel_ros2_rules/ros2/ros_cc.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# -*- python -*-

load("//tools:ament_index.bzl", "AmentIndex")
load(
"//tools:common.bzl",
"incorporate_rmw_implementation",
)
load(
"//tools:dload_cc.bzl",
"dload_cc_ldwrap",
Expand All @@ -10,11 +15,6 @@ load(
"filter_to_only_common_kwargs",
"remove_test_specific_kwargs",
)
load(
"//tools:common.bzl",
"incorporate_rmw_implementation",
)
load("//tools:ament_index.bzl", "AmentIndex")
load(
":distro.bzl",
"RUNTIME_ENVIRONMENT",
Expand Down
8 changes: 4 additions & 4 deletions bazel_ros2_rules/ros2/ros_py.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# -*- python -*-

load(
"//tools:common.bzl",
"incorporate_rmw_implementation",
)
load(
"//tools:dload_py.bzl",
"dload_py_shim",
Expand All @@ -9,10 +13,6 @@ load(
"filter_to_only_common_kwargs",
"remove_test_specific_kwargs",
)
load(
"//tools:common.bzl",
"incorporate_rmw_implementation",
)
load(
":distro.bzl",
"RUNTIME_ENVIRONMENT",
Expand Down
8 changes: 4 additions & 4 deletions bazel_ros2_rules/ros2/rosidl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@python_dev//:version.bzl", "PYTHON_EXTENSION_SUFFIX")
load("//tools:ament_index.bzl", "AmentIndex")
load(
":_calculate_rosidl_capitalization.bzl",
"calculate_rosidl_capitalization",
)
load(
":distro.bzl",
"AVAILABLE_TYPESUPPORT_LIST",
"REPOSITORY_ROOT",
)
load(
":_calculate_rosidl_capitalization.bzl",
"calculate_rosidl_capitalization",
)

RosInterfaces = provider(
fields = ["interfaces"],
Expand Down
7 changes: 5 additions & 2 deletions drake_ros/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ load("@bazel_ros2_rules//deps:defs.bzl", "add_bazel_ros2_rules_dependencies")
add_bazel_ros2_rules_dependencies()

load("@bazel_ros2_rules//ros2:defs.bzl", "ros2_local_repository")
load("//:required_packages.bzl", "DRAKE_ROS_REQUIRED_PACKAGES")
load("//:required_packages.bzl", "DRAKE_ROS_TEST_DEPENDENCIES")
load(
"//:required_packages.bzl",
"DRAKE_ROS_REQUIRED_PACKAGES",
"DRAKE_ROS_TEST_DEPENDENCIES",
)

DRAKE_ROS_ALL_DEPENDENCIES = \
DRAKE_ROS_REQUIRED_PACKAGES + DRAKE_ROS_TEST_DEPENDENCIES
Expand Down
6 changes: 3 additions & 3 deletions drake_ros/drake.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DRAKE_SUGGESTED_VERSION = struct(
url = "https://github.com/RobotLocomotion/drake/archive/refs/tags/v1.26.0.tar.gz", # noqa
sha256 = "f10b50b695ea29430cc291d1019b4cc1aceedcebec3290110b24b7e48c5f5588", # noqa,
strip_prefix = "drake-1.26.0",
url = "https://github.com/RobotLocomotion/drake/archive/refs/tags/v1.28.0.tar.gz", # noqa
sha256 = "6ff298d7fbc33cb17963509f86fcd9cb6816d455b97b3fd589e1085e0548c2fe", # noqa,
strip_prefix = "drake-1.28.0",
)
2 changes: 1 addition & 1 deletion drake_ros/drake_ros/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@ros2//:ros_py.bzl", "ros_py_test")
load(
"@drake//tools/skylark:pybind.bzl",
"pybind_py_library",
)
load("@ros2//:ros_py.bzl", "ros_py_test")

# TODO(Aditya): Add focused unittest for qos_pybind.h
cc_library(
Expand Down
2 changes: 1 addition & 1 deletion drake_ros_examples/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ local_repository(
path = "../drake_ros",
)

load("@drake_ros_repo//:required_packages.bzl", "DRAKE_ROS_REQUIRED_PACKAGES")
load(
"@drake_ros_repo//:required_packages.bzl",
"DRAKE_ROS_REQUIRED_PACKAGES",
"drake_ros_fail_if_missing_required_packages",
)

Expand Down
3 changes: 1 addition & 2 deletions drake_ros_examples/examples/hydroelastic/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

load("@ros2//:ament_index.bzl", "ament_index_share_files")
load("@ros2//:ros_cc.bzl", "ros_cc_binary")
load("@ros2//:ros_py.bzl", "ros_py_binary")
load("@ros2//:ros_py.bzl", "ros_py_test")
load("@ros2//:ros_py.bzl", "ros_py_binary", "ros_py_test")

# We use `ament_index_share_files` so we can write code that can find
# resources both when built by CMake and by Bazel.
Expand Down
3 changes: 1 addition & 2 deletions drake_ros_examples/examples/iiwa_manipulator/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# vi: set ft=python :

load("@ros2//:ros_cc.bzl", "ros_cc_binary")
load("@ros2//:ros_py.bzl", "ros_py_binary")
load("@ros2//:ros_py.bzl", "ros_py_test")
load("@ros2//:ros_py.bzl", "ros_py_binary", "ros_py_test")

ros_cc_binary(
name = "iiwa_manipulator",
Expand Down
7 changes: 3 additions & 4 deletions drake_ros_examples/examples/multirobot/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
# vi: set ft=python :

load("@ros2//:ros_cc.bzl", "ros_cc_binary")
load("@ros2//:ros_py.bzl", "ros_py_binary")
load("@ros2//:ros_py.bzl", "ros_py_test")
load("@ros2//:ros_py.bzl", "ros_py_binary", "ros_py_test")

ros_cc_binary(
name = "multirobot",
srcs = ["multirobot.cc"],
data = [
"@drake//manipulation/models/iiwa_description:models",
"@drake_models//:iiwa_description",
],
rmw_implementation = "rmw_cyclonedds_cpp",
visibility = ["//visibility:public"],
Expand All @@ -32,7 +31,7 @@ ros_py_binary(
name = "multirobot_py",
srcs = ["multirobot.py"],
data = [
"@drake//manipulation/models/iiwa_description:models",
"@drake_models//:iiwa_description",
],
main = "multirobot.py",
rmw_implementation = "rmw_cyclonedds_cpp",
Expand Down
11 changes: 5 additions & 6 deletions drake_ros_examples/examples/multirobot/multirobot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ int main(int argc, char** argv) {
scene_visualizer->get_graph_query_input_port());

// Prepare to load the robot model
auto parser = drake::multibody::Parser(&plant);
auto model_file_path = drake::FindResourceOrThrow(
"drake/manipulation/models/iiwa_description/urdf/"
"iiwa14_polytope_collision.urdf");
auto model_file_url =
"package://drake_models/iiwa_description/urdf/"
"iiwa14_polytope_collision.urdf";
const std::string model_name = "kuka_iiwa";

// Create a 5x5 array of manipulators
Expand All @@ -84,9 +83,9 @@ int main(int argc, char** argv) {
// coordinates in the array
std::stringstream model_instance_name;
model_instance_name << model_name << xx << '_' << yy;
auto parser = drake::multibody::Parser(&plant);
parser.SetAutoRenaming(true);
auto model_instance = parser.AddModels(model_file_path)[0];

auto model_instance = parser.AddModelsFromUrl(model_file_url)[0];
plant.RenameModelInstance(model_instance, model_instance_name.str());

// Weld the robot to the world so it doesn't fall through the floor
Expand Down
9 changes: 5 additions & 4 deletions drake_ros_examples/examples/multirobot/multirobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ def main():
scene_visualizer.get_graph_query_input_port())

# Prepare to load the robot model
parser = Parser(plant)
model_file_path = FindResourceOrThrow(
'drake/manipulation/models/iiwa_description/urdf/iiwa14_polytope_collision.urdf')
model_file_url = (
'package://drake_models/iiwa_description/urdf/'
'iiwa14_polytope_collision.urdf')
model_name = "kuka_iiwa"

# Create a 5x5 array of manipulators
Expand All @@ -95,7 +95,8 @@ def main():
for y in range(NUM_COLS):
# Load the model from the file and give it a name based on its X
# and Y coordinates in the array
(iiwa,) = parser.AddModels(model_file_path)
parser = Parser(plant)
(iiwa,) = parser.AddModels(url=model_file_url)
models[x].append(iiwa)
plant.RenameModelInstance(model_instance=iiwa,
name=model_name + str(x) + '_' + str(y))
Expand Down
3 changes: 1 addition & 2 deletions drake_ros_examples/examples/rs_flip_flop/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# vi: set ft=python :

load("@ros2//:ros_cc.bzl", "ros_cc_binary")
load("@ros2//:ros_py.bzl", "ros_py_binary")
load("@ros2//:ros_py.bzl", "ros_py_test")
load("@ros2//:ros_py.bzl", "ros_py_binary", "ros_py_test")

ros_cc_binary(
name = "rs_flip_flop",
Expand Down
21 changes: 12 additions & 9 deletions ros2_example_bazel_installed/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
workspace(name = "ros2_example_bazel_installed")

load("//tools:environ.bzl", "environment_repository")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

environment_repository(
name = "ros2_example_bazel_installed_environ",
envvars = ["ROS2_DISTRO_PREFIX"],
)

load(
"@ros2_example_bazel_installed_environ//:environ.bzl",
"ROS2_DISTRO_PREFIX",
)

# Skylib workspace boilerplate
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
Expand Down Expand Up @@ -45,8 +38,11 @@ load("@bazel_ros2_rules//deps:defs.bzl", "add_bazel_ros2_rules_dependencies")

add_bazel_ros2_rules_dependencies()

load("@bazel_ros2_rules//ros2:defs.bzl", "ros2_archive")
load("@bazel_ros2_rules//ros2:defs.bzl", "ros2_local_repository")
load(
"@bazel_ros2_rules//ros2:defs.bzl",
"ros2_archive",
"ros2_local_repository",
)

# TODO(Aditya): Replace with a proper rule later.
new_local_repository(
Expand All @@ -56,12 +52,19 @@ new_local_repository(
visibility = ["//visibility:public"])""",
)

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
name = "com_github_gflags_gflags",
tag = "v2.2.2",
remote = "https://github.com/gflags/gflags.git",
)

load(
"@ros2_example_bazel_installed_environ//:environ.bzl",
"ROS2_DISTRO_PREFIX",
)

# Please keep this list sorted
ROS2_PACKAGES = [
"action_msgs",
Expand Down
3 changes: 1 addition & 2 deletions ros2_example_bazel_installed/ros2_example_apps/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# -*- mode: python -*-
# vi: set ft=python :

load("@ros2//:ros_cc.bzl", "ros_cc_binary")
load("@ros2//:ros_cc.bzl", "ros_cc_test")
load("@ros2//:ros_cc.bzl", "ros_cc_binary", "ros_cc_test")
load("@ros2//:ros_py.bzl", "ros_py_binary", "ros_py_test")
load("@ros2//:rosidl.bzl", "rosidl_interfaces_group")
load("//tools:cmd_test.bzl", "cmd_test")
Expand Down
4 changes: 2 additions & 2 deletions ros2_example_bazel_installed/tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- python -*-

exports_files(["cmd_exec.sh"])

load(
"@ros2//:ros_py.bzl",
"ros_py_binary",
)

exports_files(["cmd_exec.sh"])

ros_py_binary(
name = "ros2",
srcs = ["ros2.py"],
Expand Down
Loading