-
Notifications
You must be signed in to change notification settings - Fork 0
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
ros1 ros_comm that publishes/subscribes straight to zenoh #7
Comments
Sending this many bytes inside the ros_comm publish():
but in zenoh_image_to_contour receiving
It was the extra length header from ros1 rospy code, getting rid of it fixes the issue, need to get rid of it everywhere else, it's redundant with zenoh headers that store the length? But not sure if mcap needs it or not, it likely expects it so need to add it back when rosbagging. ros2 has an extra extra 4 bytes https://robotics.stackexchange.com/questions/105832/ros2-why-the-serialized-message-have-additional-bytes-at-the-beginning? |
http://wiki.ros.org/ROS/Connection%20Header - this supplies the message type and definition, follow the tcpros thread to see how it is shared. Are there checksums or other unnecessary cruft elsewhere in the serialized bytes that could be eliminated, that mcap and zenoh already take care of? |
Now implement the subscriber side- this is a little less straight forward because of the callbacks, need to duplicate what rospy topics.py Subscriber has Was actually straightforward: lucasw/ros_comm@a5afa9e Can now publish straight from zenoh, or through rospy, and subscribe in rospy or zenoh any combination. Next do the C++ equivalent, and test what happens when |
Also modify rostopic echo, store the message definitions somewhere in can get so this can be avoided:
|
roscpp C++ TopicManager looks like the easiest place to put a |
Putting #include <zenohc.hxx> in topic manager.h results in this:
It works in the cpp files but then I have trouble with templated functions to serialize messages |
Can't do this, need to use zenohc?
|
Maybe this is the root of the problem, in api.hxx
But I only need it once in the zenohc namespace |
https://github.com/lucasw/ros_comm/tree/zenoh_pub_sub_cpp https://github.com/lucasw/ros_one2z/tree/zenoh_cpp_ros_comm still getting multiple definition- though I was onto something with separated out api.hxx and impl.hxx includes but it still doesn't work. Maybe put all the zenoh code into one cpp file? The issues with templating seem worked out at least |
eclipse-zenoh/zenoh-cpp#87 - works with latest zenoh_cpp_ros_comm- can run a C++ ros node using the modified ros_comm and publish an image that a zenoh python script receives |
ros::serialization::serializationLength(*image_msg) returns a proper value, but once inside Publisher::publish it returns a value too small by a factor of 10- something is lost with the templating? No that's a cout formatting issue, it's not printing size_t properly |
Saw in a presentation that zeno ros1 bridge can also replace roscore, would commingling that make doing things with this custom ros_comm work better? |
Need to add C++ subscriber support to ros_comm zenoh_pub_sub_cpp- rospy pub/sub works, and roscpp publishing, so this is the last thing (before diving into how to make rostopic/rosnode list etc. work, or just calling that good enough).
TopicManager seems like the route to follow, it creates a Subscription, calls addCallback and registerSubscriber on it. This turns a buffer of bytes into a SerializedMessage and calls handleMessage on it (why in the publisher link only, don't see a subscriber link version): |
Turn a zenoh Sample payload into ros SerializedMessage https://github.com/ros/roscpp_core/blob/noetic-devel/roscpp_serialization/include/ros/serialized_message.h#L56C1-L62 It looks like the handleMessage is getting called, but the imageCallback isn't getting called, and then the node crashes, try running in gdb
The issue was the const pointer from the zenoh sample payload can't be put into a boost::shared_array for a ros SerializedMessage, it wants to own it and delete the memory (requires that it had been created by |
run ros_comm tests with zenoh modifications (also need to run on unmodified ros_comm to see if they were passing before)
or make a new workspace and use catkin_make in it
|
https://github.com/cvilas/grape/tree/main/modules/common/ipc/examples has either copies or modified versions of the official examples, but also notes about how to use shared memory properly (need to configure it in config files).
|
Need to manually add the zenoh library to this and everything- really need to export it properly:
Maybe just modify catkin to always provide it with catkin_LIBRARIES? No not everything in C++ needs it, just roscpp users. Need to use catkin_package DEPEND for this in roscpp
|
With lucasw/ros_from_src#33 working can now fix any test that breaks because of zenoh changes, first one
publisher needs to be non-const ✔️ |
Also
The catkin_make run_tests is inside a venv which has zenoh, is the test running outside of it? Maybe https://stackoverflow.com/questions/35045038/how-do-i-use-pytest-with-virtualenv
Would installing an older pytest use an older poetry and make this work?
No that doesn't work, still failing on import inside the test
https://stackoverflow.com/a/1883251/603653 Maybe need catkin installed inside venv?
No that doesn't have catkin_make in it https://github.com/ros/catkinhttps://github.com/ros/catkin is where catkin_make comes from This doesn't work
try installing from checked out source
|
Go back to catkin build -maybe it runs inside venv
No same failures |
Need to install zenoh outside of the venv
(not using This is what pip installed, so duplicate these outside, manually add these site packages:
cargo build ./target/release/libzenoh.so instead of zenoh.abi3.so, and zenoh-python/zenoh has all the same python files as in site-packages above. What this looks to amount to is a manual circumvention of the 23.04+ policy against installing python packages system/user wide outside of a venv, which is mostly fine if it is just zenoh. Why can't I apt install python zenoh? eclipse-zenoh/roadmap#112 But ros workspaces are already little virtual environments, they have their own site-packages and add it to the python path- could I make venv right on top of the catkin_ws/devel, then pip install right into it? (a catkin clean would wipe it out though, all the pip installs would need to be triggered again)
Before that going to try symlinking the venv install into a location already in my PYTHONPATH (added by my .bashrc but maybe I should stop doing that):
-> the symlink works fine ✔️ Probably could make a ros package that wraps all of zenoh-python and then it would get installed locally without jumping through extra steps (though it needs to wrap cargo build) |
https://robotics.stackexchange.com/questions/101542/what-controls-the-python-search-path-and-how try a clean rebuild inside the venv No that doesn't work, it did sucessfully make devel/_setup_util.py use |
Maybe catkin workspaces could be made into proper python virtual environments, and every ros package with python would get pip installed (and then that would also be the solution all the setup.py warnings)? Or would that make it not possible to do workspace overlays? locusrobotics/catkin_virtualenv#11 |
|
utilities/message_filters/test/test_message_filters_cache.py is hanging when run locally (23.04)
It succeeds when run directly but then hangs. -> There are unit tests that create rospy Subscribers without calling init_node, and stuff messages into them using |
Can't have |
rosbag tests are failing because bags written to Maybe that isn't true, not sure how to properly run those tests, they generate rostest xml files from a template and those end up in this is the very test to look for .active- fix this and a bunch else works better (and is less annoying, that's issue has been bothering me in 22.04 ros-one for a while- will need to backport the fix to non-zenoh ros_comm? But no that unit test it passing upstream so maybe that is fixed already?):
to debug, run the chatter pub manually
(it just does a and then rosbag record, and will have to dive into record source to see where it isn't catching sigint. It looks like zenoh rosbag record isn't working at all (exits out immediately), need to fix that, but debug the .active sigint issue first. The debian rosbag A salsa_noetic_aggregated rosbag doesn't handle ctrl-c- but does the unit test pass?
Now have that signit test passing in 22.04, but rosbag record -a still leaves an .active behind- inside the docker file 20.04 it exits clean (and the unit test passes as expected). So the unit test is no help, what is the difference between the real ctrl-c and the programmatic sigint for rosbag? revisit ros/ros_comm#2038
|
It looks like the rosbag .active issue only exists in when also using a custom rosconsole -> https://github.com/lucasw/rosconsole/tree/ubuntu_2210 is rebased off of obese-devel and looks to be working, no more bag.active ✔️ |
This is the venv issue: ros/ros_comm#2149 Looks like I can disable PythonPathOverride in my ros_comm fork, then don't have to do the above workaround of installing zenoh outside of pip (that will take some manual cleanup)
|
Try this in rospy first, make a https://github.com/lucasw/ros_comm branch
https://github.com/lucasw/ros_comm/tree/zenoh_pub_sub
setup
See https://github.com/lucasw/ros_one2z/blob/zenoh/README.md#ros_comm-with-zenoh for the most updated and complete instructions, the following is less complete:
(base ros packages including cv_bridge, sensor_msgs, etc. already installed)
repos.yaml:
The text was updated successfully, but these errors were encountered: