-
Notifications
You must be signed in to change notification settings - Fork 136
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
Cargo can't find Std_msgs
#374
Comments
Thanks for reporting this problem. We should fix the instructions to say that you should build your package in the same colcon workspace that rclrs and your message packages were built in according to the README instructions. Ideally it should be possible to build your package in a separate colcon workspace with the original workspace as an underlay, but I just tested it out and it seems there's a bug in colcon-cargo that currently prevents that from working. I'll try to investigate that problem. |
Thank you for your reply. I don't know how to add the appropriate commands to my docker file. That's what you want me to do, isn't it?
Perhaps the Docker Forum can help. I'll give it a try. |
yeah, it doesn't work. |
I also ran into this problem, managed to get around it by including the path in the dependency section of my Cargo.toml (without building ros2_rust in the same directory as my project), for example: std_msgs = { path = "/home/newton/workspace/install/std_msgs/share/std_msgs/rust" } and also including it in my package.xml (not the whole path just std_msgs). Hope this helps!! |
Yes, in the meantime I've also been working a bit with the manifest format of rust and therefore now know that it can work like this. My personal problem with this approach is that you cannot publish the package in this way, neither on crates nor on gitlab, as it is already a very individually functioning thing. |
I see what you mean, it's definitely not an end-all fix. I tinkered for a bit exploring for the root of the problem, the best hypothesis I could come up with is that rosidl_generator_rs isn't generating bindings correctly (could be a couple causes for that). std_msgs is handled through the ROS2 build system (not Cargo), so rosidl_generator_rs generates the Rust bindings for the ROS2 packages, allowing for them to be used in Rust code. Once the bindings are generated, then the types defined in ROS2 packages can be imported as modules; the catch being that the modules only exist after the bindings have been generated, and won't be known to Rust or Cargo until then. What's probably happening is that rosidl_generator_rs isn't properly set up or not generating bindings as expected. How to remedy this is still beyond me, but will definitely report back if I find out anything more. Good luck with your project in the meantime! |
I followed your example This gave me the following error output:
Here you can see my current status for comparison.
The text was updated successfully, but these errors were encountered: