alexandru-dinu / ros-flow

Experimental ROS project.
MIT License
0 stars 1 forks source link

Initial to-dos #2

Open alexandru-dinu opened 3 years ago

alexandru-dinu commented 3 years ago
mariustache commented 3 years ago

I have created a hello_world package and tried to add rosrust and rosrust_msg as dependencies, using the latest info from the official repository. It seems that rosrust_msg fails to compile in both release and debug modes.

Output:

error: proc macro panicked
 --> /home/marius/git/learning_git/rosrust/target/release/build/rosrust_msg-f37fe534ccaa2864/out/messages.rs:3:9
  |
3 |         rosrust::rosmsg_include!(,IGNORE_BAD);
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: message: Package string needs to be in package/name format: 

error: aborting due to previous error

error: could not compile `rosrust_msg`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
alexandru-dinu commented 3 years ago

My guess is that this happens because there are no messages found (in the current project).

We may solve this by creating a new rust project, defining the ROS messages, then compiling the project with rosrust and rosrust_msg as dependencies. This will generate rust code for each message type available in the project.

mariustache commented 3 years ago

You are correct. I have tried a test setup and it worked.

I defined a dummy package called ros_test_msg that contains a msg/Standard.msg message. I set ROSRUST_MSG_PATH to this path (~/foo/bar/ros_test_msg) and ran cargo build. The build was successful.

I have tried adding a msg folder in the current project. The compilation failed because ROS packages must follow REP 144 (ROS package naming) convention and our repository (ros-flow) does not adhere to this.

mariustache commented 3 years ago

It seems that the automatic message generation still doesn't work.

I have tried building manually in a ros:kinetic container and it works, but using Dockerfile still fails. It seems like the PATH is properly set when running the container, but not when building. It's like it is overwritten after the FROM command.

This answer is useful: https://answers.ros.org/question/356401/is-ros-already-sourced-if-i-do-it-from-a-dockerfile/

mariustache commented 3 years ago

Every RUN instruction that expects a sourced ROS environment must start with: RUN . /opt/ros/$ROS_DISTRO/setup.sh && ...

I have tested this with ros:kinetic (ROS1) image and it works. It seems that with ros:foxy (ROS2), rosrust_msg message generation fails because it uses rosmsg list to extract all the messages, which is no longer available in ROS2.