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

How does support for custom messages work. #123

Closed
tdejager opened this issue Nov 9, 2019 · 7 comments
Closed

How does support for custom messages work. #123

tdejager opened this issue Nov 9, 2019 · 7 comments

Comments

@tdejager
Copy link

tdejager commented Nov 9, 2019

Hi,

This is more of a question than an issue. I wanted to test the rosrust library with our own message types. But I'm unable to get it working with our workspace setup. The catkin workspace is set-up, and everything is sourced. It seems that the include_message macro looks at the following locations:

        /home/tdejager/ros/melodic/smart_robotics/devel/share
          /opt/ros/melodic/share
          /home/tdejager/ros/melodic/smart_robotics/devel/../src
          /opt/ros/melodic/../src

So that is the share folder for the catkin workspace and the source folder. However, I think that the messages for packages in the user workspace are not copied to the share folder. At least, I can't seem to find them there. As opposed to std_msgs, which are included in the installation.

Also as for the source folder, the required package is not located directly in the root, but in a subdirectory.

Am I missing something? Could you maybe share some info on how the include macro is supposed to work or how your workspace is setup?

Thanks!

@adnanademovic
Copy link
Owner

Where are your messages located? The actual .msg files I mean. Are they in /home/tdejager/ros/melodic/smart_robotics/src/my_package/msg/SomeMessage.msg?

@tdejager
Copy link
Author

tdejager commented Nov 9, 2019

They are actually in a subfolder for our (mono)-repo, so /home/tdejager/melodic/smart_robotics/sr-common/sr_msgs/msg/Foo.msg

@adnanademovic
Copy link
Owner

Oh I never considered if catkin_make can find packages that aren't directly located in the src folder. I guess the codegen should search through the subfolders as well. I'll try to get to that soon.

@andresv
Copy link

andresv commented Nov 9, 2019

I have following structure:

|-common/msg/SomeMsg.msg
|-rustnode

All custom messages are under common/msg. I use ROSRUST_MSG_PATH to specify where those messages are.
So following lines are in rustnode/CMakeLists.txt

COMMAND ROSRUST_MSG_PATH=${CMAKE_CURRENT_SOURCE_DIR}/.. cargo build --release --target-dir ${CMAKE_BINARY_DIR}/cargo/
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/cargo/release/rustnode ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/rustnode

In rustnode I can include them as:

use rosrust;

rosrust::rosmsg_include!(
                common/SomeMsg,
);

@tdejager
Copy link
Author

Wow, thank you both for the answers. And thank you for making this project btw @adnanademovic, you have done a lot of great work :)

@andresv Thanks for that solution, I'll try it out. Is that also how you are building the rust project in the catkin workspace?

@adnanademovic If you give me some pointers where to start, I've checked the proc-macro code a bit. I could try to make a PR for that?

@andresv
Copy link

andresv commented Nov 10, 2019

@tdejager, yes, this how my rust nodes are integrated with catkin. So basically others almost even do not know that there are rust nodes. They just run catkin_make as always.

@OTL
Copy link
Contributor

OTL commented Nov 11, 2019

+1 for searching subdirectories as @adnanademovic says.
I need a lot of ROSRUST_MSG_PATH to handle my/others meta packages.

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

4 participants