-
Notifications
You must be signed in to change notification settings - Fork 1
Generic Drake/ROS systems + RS Flip Flop example #6
Conversation
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Publisher and ROS interface working, subscriber not yet working. Signed-off-by: Shane Loretz <[email protected]> Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! However, I don't understand much of the code in py_serializer.hpp
, so another pair of eyes would be welcome.
I have built and tested the example with both the colcon and cmake workflows, and they both work!
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
This adds a way to provide the node name and node options, as well as a way to externally manage init/shutdown on a context. If the given node options have a valid context, then DrakeRos won't call init or shutdown on it. In this way external code can pass init options. Signed-off-by: Shane Loretz <[email protected]> Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Adds half a type caster (Python -> C++) for rclpy.qos.QoSProfile to rclcpp::QoS. Adds QoS arguments to Python publisher and subscriber systems. Updates the Python example to pass QoS. Signed-off-by: Shane Loretz <[email protected]> Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Placing one pair of 👀 here |
(Going to use Reviewable tho) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 25 files reviewed, 3 unresolved discussions (waiting on @sloretz)
drake_ros_systems/src/python_bindings/py_serializer.hpp, line 30 at r4 (raw file):
{ // Serialize/Deserialize Python ROS types to rclcpp::SerializedMessage class PySerializer : public SerializerInterface
It's a bit challenging to analyze and review Python code flow in C++.
(Also, pumping stuff back and forth btw the two may be less efficient?)
As my own rule of thumb, anything that calls pybind11
s Python C++ API more than 3 times in succession should generally be done in a Python function.
Is it possible for you to relegate this code to Python, and use something like what Drake to does to invoke Python code?
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 27 files reviewed, 3 unresolved discussions (waiting on @EricCousineau-TRI and @sloretz)
drake_ros_systems/src/python_bindings/py_serializer.hpp, line 30 at r4 (raw file):
Previously, EricCousineau-TRI (Eric Cousineau) wrote…
It's a bit challenging to analyze and review Python code flow in C++.
(Also, pumping stuff back and forth btw the two may be less efficient?)As my own rule of thumb, anything that calls
pybind11
s Python C++ API more than 3 times in succession should generally be done in a Python function.Is it possible for you to relegate this code to Python, and use something like what Drake to does to invoke Python code?
Relegated a bit more to Python in 22880a8
I think this PR is just waiting on review. There's a little bit of test coverage now in the form of linters, a couple integration tests (one for C++, one for Python) and a small unit test for the |
Most of this is going into https://github.com/RobotLocomotion/drake-ros I'll merge this and archive this repo. |
This adds generic ROS publisher/subscriber systems as described in RobotLocomotion/drake#9500. It's similar to https://github.com/gizatt/drake_ros_systems , but this uses ROS 2 and matches the LCM publisher/subscriber system's design more closely.
RS Flip Flop example
There's an example of an RS flip flop system that listens to topics
/S
, and/R
and publishes to topics/Q
and/Q_not
.To try this example out:
colcon build --packages-select drake_ros_systems
rs_flip_flop
examplesbuild
folder:./build/drake_ros_systems/example/rs_flip_flop
example
folder:python3 rs_flip_flop.py
Echo output topics:
Send values to the input topics
Future enhancements
C++
DrakeRos
spin
functions inrclcpp
that indicate f if spin did something, and if so pause Drake's concept of time to handle multiple messages just like LcmInterfaceSystem does.Python
pybind11::capsule::get_pointer()
when availableCode copying
The generic publisher and subscriber using raw messages was significantly copied from
rosbag2_transport
: https://github.com/ros2/rosbag2/tree/master/rosbag2_transport but it should probably be change to use these classes (not yet merged ros2/rclcpp#1452)The Drake boilerplate in RosInterfaceSystem, RosSubscriberSystem, and RosPublisherSystem was significantly copied from the equivalent LCM systems in drake.
This change is