Skip to content

Commit

Permalink
[realsense2_description] Add docs and build system
Browse files Browse the repository at this point in the history
  • Loading branch information
jwnimmer-tri committed Mar 26, 2024
1 parent a9dbeac commit 6546005
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
32 changes: 32 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
load(":defs.bzl", "xacro_file")

_XACROS = {
"realsense2_description/urdf/d415.urdf": {
"src": "realsense2_description/urdf/customized/test_d415_camera.urdf.xacro",
"data": [
"realsense2_description/urdf/customized/_d415.urdf.xacro",
"realsense2_description/urdf/customized/_materials.urdf.xacro",
"realsense2_description/urdf/customized/_usb_plug.urdf.xacro",
],
},
"tri_homecart/homecart_bimanual.urdf": {
"src": "tri_homecart/homecart_bimanual.urdf.xacro",
"data": [],
Expand Down Expand Up @@ -37,3 +45,27 @@ _XACROS = {
)
for name in _XACROS
]

# Patch the realsense files to suit this repository.
[
genrule(
name = "_gen_{}".format(filename),
srcs = [
"realsense2_description/urdf/customize.sed",
"realsense2_description/urdf/{}".format(filename),
],
outs = [
"realsense2_description/urdf/customized/{}".format(filename),
],
cmd = "sed --file={} {} > $@".format(
"$(execpath realsense2_description/urdf/customize.sed)",
"$(execpath realsense2_description/urdf/{})".format(filename),
),
)
for filename in [
"test_d415_camera.urdf.xacro",
"_d415.urdf.xacro",
"_materials.urdf.xacro",
"_usb_plug.urdf.xacro",
]
]
10 changes: 10 additions & 0 deletions realsense2_description/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Intel RealSense cameras

This folder contains models of the Intel RealSense cameras.

The models were originally published by Intel here
https://github.com/IntelRealSense/realsense-ros
but have been further customized for use by Drake, e.g., changing the
mesh paths and mesh file formats.

Drake's models are based on v4.54.1 from the Intel repository.
10 changes: 10 additions & 0 deletions realsense2_description/urdf/customize.sed
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Note that $(...) stuff in the below is NOT special regex characters, we are
# actually matching the xacro text like "$(arg use_mesh)" literally.

s|$(find realsense2_description)/urdf/||;
s|file://$(find realsense2_description)/meshes/|../meshes/|;
s|$(arg use_mesh)|true|;
s|$(arg use_nominal_extrinsics)|false|;
s|$(arg add_plug)|false|;
s|package://realsense2_description|package://drake/manipulation/models/realsense2_description|;
s|\.stl|.obj|;
2 changes: 1 addition & 1 deletion realsense2_description/urdf/d415.urdf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- | This document was autogenerated by xacro from external/intel_realsense_ros_internal/realsense2_description/urdf/test_d415_camera.urdf.xacro | -->
<!-- | This document was autogenerated by xacro from bazel-out/k8-fastbuild/bin/realsense2_description/urdf/customized/test_d415_camera.urdf.xacro | -->
<!-- | EDITING THIS FILE BY HAND IS NOT RECOMMENDED | -->
<!-- =================================================================================== -->
<robot name="realsense2_camera">
Expand Down

0 comments on commit 6546005

Please sign in to comment.