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

roslibrust ros1 native example node with multiple subscriber and timed publishing #11

Closed
lucasw opened this issue Jun 28, 2024 · 4 comments

Comments

@lucasw
Copy link
Owner

lucasw commented Jun 28, 2024

Make a ros node with several subscriber and publishers using the roslibrust ros1 native feature:

https://github.com/Carter12s/roslibrust?tab=readme-ov-file#experimental-support-for-ros1-native

https://github.com/lucasw/ros_one2z/tree/main/ros1_rlr

So far roslibrust has seems to be able to find ros messages from ROS_PACKAGE_PATH better than rosrust (certain messages cause the rosrust build to fail, TBD insert link to issue/comments about that).

But maybe roslibrust build times are much longer (haven't tried rosrust recently) - is that because it is building a lot of messages that go unused? This also may be because I'm calling the message codegen macro, try following the example (https://github.com/Carter12s/roslibrust?tab=readme-ov-file#code-generation-of-ros-messages https://github.com/Carter12s/roslibrust/blob/master/example_package/build.rs). Could also try curating ROS_PACKAGE_PATH just for building this, only provide paths to the messages it needs.

Lots of basic ros features are missing (e.g. __name __ns and topic remap RosLibRust/roslibrust#113), but really if only publishing and subscribing work the rest can be worked around. The namespace features can be implemented in the node (and then put into a library here, and then probably can figure out how to add them upstream after that).

Probably need Corrosion and build with cmake to get the nodes to a place where rosrun and roslaunch will work, but perhaps the right cargo command (--out-dir?) can place the binaries where needed. But the name and namespacing comes first.

Need to learn tokio to have multiple subscribers and timed publishing in the same node. Seems more complicated than it ought to be but I suppose rospy and roscpp went to a lot of effort to hide inherent complexities.

Haven't tried service calls yet- ultimately want dynamic reconfigure working (or 'dynamic dynamic reconfigure', don't bother with implementing .cfg message building) but could live without that for a while. Can implement the dynamic reconfigure interface manually here then maybe push it upstream or into a standalone crate later.

@lucasw
Copy link
Owner Author

lucasw commented Jun 28, 2024

roslibrust mentions having to turn on the ros1 feature to get the ros1 native nodes, looks like this happened automatically:

ros1_rlr$ cargo tree -e features | grep roslibrust
├── roslibrust feature "default"
│   └── roslibrust v0.9.0
│       ├── roslibrust_codegen feature "default"
│       │   ├── roslibrust_codegen v0.9.0
│       │   └── roslibrust_codegen feature "tokio"
│       │       └── roslibrust_codegen v0.9.0 (*)
│       ├── roslibrust_codegen_macro feature "default"
│       │   └── roslibrust_codegen_macro v0.9.0 (proc-macro)
│       │       ├── roslibrust_codegen feature "default" (*)
├── roslibrust feature "ros1"
│   └── roslibrust v0.9.0 (*)
├── roslibrust_codegen feature "default" (*)
├── roslibrust_codegen_macro feature "default" (*)

@lucasw
Copy link
Owner Author

lucasw commented Jun 28, 2024

rostopic echo works on a topic published by this node, but rostopic hz doesn't, no new messages - isn't rostopic hz subscribing no different than echo, or is it doing something behind the scenes not supported here?

-> The difference is that rostopic hz uses rospy.AnyMsg- something is missing from the message (connection header?) to break that?

https://github.com/Carter12s/roslibrust/blob/883057f8d159b0298c243744d65971e746ec5dbc/roslibrust/src/ros1/publisher.rs#L97

@lucasw
Copy link
Owner Author

lucasw commented Jun 28, 2024

This gets me a much smaller ROS_PACKAGE_PATH, but not sure if build times are improved:

source ~/ros/ros1/install/overlay_2404_ws/install/setup.bash

If I don't want to have to know the right paths and build time, is there a way build.rs could search within ROS_PACKAGE_PATH just for the messages/message packages I need (which could be listed in build.rs). This would be the similar to having to list packages in package.xml. Or call rospack find and build a special ROS_PACKAGE_PATH from that in shell script that needs to be run manually.

@lucasw
Copy link
Owner Author

lucasw commented Jun 30, 2024

Fixed with updated version of roslibrust 8a0c98c

@lucasw lucasw closed this as completed Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant