-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Finn <[email protected]>
- Loading branch information
Showing
37 changed files
with
327 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../.bazelrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# The following aliases are defined for convenience. | ||
|
||
alias( | ||
name = "roscore", | ||
actual = "@rules_ros//third_party/ros/roslaunch:roscore", | ||
) | ||
|
||
alias( | ||
name = "rosgraph", | ||
actual = "@ros_comm//:rosgraph", | ||
) | ||
|
||
alias( | ||
name = "rosparam", | ||
actual = "@ros_comm//:rosparam", | ||
) | ||
|
||
alias( | ||
name = "rosbag_record", | ||
actual = "@ros_comm//:rosbag_record", | ||
) | ||
|
||
alias( | ||
name = "rosbag_play", | ||
actual = "@ros_comm//:rosbag_play", | ||
) | ||
|
||
alias( | ||
name = "rosservice", | ||
actual = "@rules_ros//third_party/ros/rosservice", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
module(name = "rules_ros_examples") | ||
|
||
bazel_dep(name = "rules_python", version = "0.34.0") | ||
|
||
# This import is relevant for these examples and this (rules_ros) repository. | ||
bazel_dep(name = "rules_ros") | ||
local_path_override( | ||
module_name = "rules_ros", | ||
path = "..", | ||
) | ||
|
||
# In a normal workflow, you would typically import rules_ros into your | ||
# (mono)repo as follows: | ||
# bazel_dep(name = "rules_ros") | ||
# archive_override( | ||
# module_name = "rules_ros", | ||
# integrity = "sha256-<integrity sum of the .tar.gz archive below>", | ||
# strip_prefix = "rules_ros-<git commit SHA>", | ||
# urls = "https://github.com/mvukov/rules_ros/archive/<git commit SHA>.tar.gz" | ||
# ) | ||
|
||
non_module_ros_repositories = use_extension("@rules_ros//ros:extensions.bzl", "non_module_dependencies") | ||
use_repo( | ||
non_module_ros_repositories, | ||
"console_bridge", | ||
"orocos_kdl", | ||
"ros_actionlib", | ||
"ros_comm", | ||
"ros_comm_msgs", | ||
"ros_common_msgs", | ||
"ros_dynamic_reconfigure", | ||
"ros_gencpp", | ||
"ros_genmsg", | ||
"ros_genpy", | ||
"ros_geometry2", | ||
"ros_ros", | ||
"ros_std_msgs", | ||
"rosconsole", | ||
"roscpp_core", | ||
"tinyxml", | ||
"urdfdom", | ||
"urdfdom_headers", | ||
) | ||
|
||
bazel_dep(name = "rules_boost") | ||
archive_override( | ||
module_name = "rules_boost", | ||
integrity = "sha256-I1iTdF3qckTmDRab+0yjA37Iya9AOGvEGJVoPtfpADM=", | ||
strip_prefix = "rules_boost-42d8155d8f20a1aee8ee20b7903a495bdfb9befd", | ||
urls = "https://github.com/nelhage/rules_boost/archive/42d8155d8f20a1aee8ee20b7903a495bdfb9befd.zip", | ||
) | ||
|
||
non_module_boost_repositories = use_extension("@rules_boost//:boost/repositories.bzl", "non_module_dependencies") | ||
use_repo( | ||
non_module_boost_repositories, | ||
"boost", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Examples for rules_ros | ||
|
||
This folder provides some examples and guidelines on how you can use this repo | ||
in your very own (mono)repo. It's important to note here that this folder is | ||
a yet another Bazel module (it has a MODULE.bazel file). Please take a look at | ||
the module file to get an idea how to set up yourself. | ||
|
||
Besides setting up your module file, please make sure you copy the `.bazelrc` | ||
file as well to your monorepo -- or at least adjust your own using the provided | ||
one. | ||
|
||
Before you build/run/test any of the targets in this folder, please make sure | ||
your terminal is in this folder, or in a subfolder, and not in the root | ||
of the repo. | ||
|
||
You can start with a simple [chatter](chatter) example. | ||
|
||
In `dishwasher` folder you can find another example that demonstrates | ||
defining and usage of ROS actions (and actionlib). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# A chatter example | ||
|
||
Let's begin with starting `roscore`: | ||
|
||
```sh | ||
bazel run //:roscore | ||
``` | ||
|
||
In a separate terminal, let's start a (C++) talker node: | ||
|
||
```sh | ||
bazel run //chatter:talker | ||
``` | ||
|
||
This single command will compile and run the talker node. | ||
|
||
In a yet another terminal we can start a listener node: | ||
|
||
```sh | ||
bazel run //chatter:listener # C++ version or | ||
bazel run //chatter:py_listener # Python version | ||
``` | ||
|
||
Rosbag recording & playing works as well: | ||
|
||
```sh | ||
bazel run //:rosbag_record -- /chatter -o /tmp/foo.bag # to record a bag or | ||
bazel run //:rosbag_play -- /tmp/foo_<timestamp>.bag # to play a bag | ||
``` | ||
|
||
`rostopic`, tied to this example (see `BUILD.bazel` for more info) can be used as | ||
|
||
```sh | ||
bazel run //chatter:rostopic -- echo /chatter | ||
``` | ||
|
||
Not too shabby. | ||
|
||
Next, let's start a deployment with the talker and the listener nodes. You can | ||
stop the nodes you started with the above commands. Now execute | ||
|
||
```sh | ||
bazel run //chatter:chatter | ||
``` | ||
|
||
This command will build the necessary nodes and launch them. This is similar | ||
to executing good-ol' `roslaunch`, but, running the chatter `ros_launch` target | ||
using Bazel ensures all necessary dependencies are (re-)built. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<launch> | ||
<node type="examples/chatter/talker" name="talker" /> | ||
<node type="examples/chatter/listener" name="listener" output="screen" /> | ||
<node type="chatter/talker" name="talker" /> | ||
<node type="chatter/listener" name="listener" output="screen" /> | ||
</launch> |
Oops, something went wrong.