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

Issues building the ros1_bridge from source #22

Closed
mlautman opened this issue Feb 26, 2019 · 26 comments
Closed

Issues building the ros1_bridge from source #22

mlautman opened this issue Feb 26, 2019 · 26 comments
Labels
bug Something isn't working documentation Issues regarding documentation (PX4 Devguide; User guide) fix in progress

Comments

@mlautman
Copy link

mlautman commented Feb 26, 2019

Following the installation instructions in the documentation, the command colcon build --symlink-install --packages-skip ros1_bridge --event-handlers console_direct+ in the "Building the workspaces" section fails because python3 fails to find genmsg. This is discussed here but it is never resolved. I have been running source /opt/ros/$ROS1_DISTRO/setup.bash before source /opt/ros/$ROS2_DISTRO/setup.bash to get colcon to build the ros2 workspace.

Before building ros1_bridge, you must manually set FASTRTPSGEN_DIR to the location of fastrtpsgen. (eg. export FASTRTPSGEN_DIR=/usr/local/bin). Otherwise, the build will fail with generate_microRTPS_bridge.py: error: argument -f/--fastrtpsgen-dir: expected one argument

Also, you must set export ROS2_DISTRO="bouncy" # or crystal before building.

@TSC21 TSC21 added bug Something isn't working documentation Issues regarding documentation (PX4 Devguide; User guide) fix in progress labels Feb 26, 2019
@TSC21
Copy link
Member

TSC21 commented Feb 26, 2019

The current solution found for now is the one you suggest above (source the ROS1 env before the ROS2 env).

@mlautman btw, what is the current ROS2 release you are using?

@mlautman
Copy link
Author

I have tested with both bouncy and crystal

@mlautman
Copy link
Author

mlautman commented Feb 26, 2019

I think you will still need to set ROS2_DISTRO otherwise, this line will fail

@TSC21
Copy link
Member

TSC21 commented Feb 26, 2019

So you were able to build the ros1_bridge under Crystal? I am actually facing some annoying issue when building it (you can follow everything in ros2/ros1_bridge#168.

@TSC21
Copy link
Member

TSC21 commented Feb 26, 2019

I think you will still need to set ROS2_DISTRO otherwise, this line will fail

Yep, that's something I will rearrange so it's not required (this was assuming an automation script before).

@mlautman
Copy link
Author

I actually haven't been building ros1_bridge in Crystal since my goal is to build a pure ROS2 system. These notes were from when I was following the documentation line by line.

@TSC21
Copy link
Member

TSC21 commented Feb 26, 2019

I actually haven't been building ros1_bridge in Crystal since my goal is to build a pure ROS2 system. These notes were from when I was following the documentation line by line.

Alright fair point. Thanks

@mlautman
Copy link
Author

mlautman commented Feb 26, 2019

Actually, I lied. Here is how I build it 😝

In a fresh terminal, I run these commands:

        export FASTRTPSGEN_DIR=/usr/local/bin
        export ROS1_DISTRO="melodic"
        export ROS2_DISTRO="crystal"
        export ROS1_PATH="/opt/ros/$ROS1_DISTRO/setup.bash"
        export ROS2_PATH="/opt/ros/$ROS2_DISTRO/local_setup.bash"
        export ROS1_WS=$HOME/ws_ros1/
        export ROS2_WS=$HOME/ws_ros2/

        cd $ROS2_WS
        colcon build --symlink-install --packages-select ros1_bridge --cmake-force-configure --event-handlers console_direct+

Not all of the above is necessary but it works so I haven't been messing with it 🤷‍♂️

@TSC21
Copy link
Member

TSC21 commented Feb 26, 2019

@mlautman thanks! The only difference I actually see from what I was trying is the local_setup.bash instead of the setup.bash. Let's see where it gets me.

@mlautman
Copy link
Author

mlautman commented Feb 26, 2019

I'm 99% sure that was the fix. I'm currently stuck trying to get the topics to show up when I run micrortps_client start -t UDP and micrortps_agent -t UDP.

In 3 fresh shells I run:

        export FASTRTPSGEN_DIR=/usr/local/bin
        export ROS1_DISTRO="melodic"
        export ROS2_DISTRO="crystal"
        export ROS1_PATH="/opt/ros/$ROS1_DISTRO/setup.bash"
        export ROS2_PATH="/opt/ros/$ROS2_DISTRO/setup.bash"
        export ROS1_WS=$HOME/ws_tom1/
        export ROS2_WS=$HOME/ws_tom2/
        export ROS_MASTER_URI=http://localhost:11311

then in the FIRST shell I run:

        cd $HOME/src/Firmware
        make px4_sitl_rtps gazebo

then in the SECOND shell I run:

        source $ROS1_PATH
        source $ROS2_PATH
        source $ROS2_WS/install/local_setup.bash
        micrortps_agent -t UDP

This outputs:

CameraCapture subscriber started
CameraTrigger subscriber started
CollisionReport subscriber started
DebugArray subscriber started
DebugKeyValue subscriber started
DebugValue subscriber started
DebugVect subscriber started
ObstacleDistance subscriber started
OpticalFlow subscriber started
PositionSetpoint subscriber started
PositionSetpointTriplet subscriber started
TrajectoryWaypoint subscriber started
VehicleTrajectoryWaypoint subscriber started
AdcReport publisher started
Airspeed publisher started
BatteryStatus publisher started
Cpuload publisher started
DistanceSensor publisher started
EstimatorStatus publisher started
HomePosition publisher started
IridiumsbdStatus publisher started
RadioStatus publisher started
SatelliteInfo publisher started
SensorBaro publisher started
SensorCombined publisher started
SensorSelection publisher started
VehicleAttitude publisher started
VehicleOdometry publisher started
VtolVehicleStatus publisher started
WindEstimate publisher started
CollisionConstraints publisher started

Then in the FIRST shell, in pxh I run:

        micrortps_client start -t UDP

Then in the THIRD shell I run:

        source $ROS1_PATH
        source $ROS2_PATH
        source $ROS2_WS/install/local_setup.bash
        ros2 topic list

I would expect to see all of the topics from the agent but all I see is:

/parameter_events
/rosout

@TSC21
Copy link
Member

TSC21 commented Feb 26, 2019

I'm 99% sure that was the fix. I'm currently stuck trying to get the topics to show up when I run micrortps_client start -t UDP and micrortps_agent -t UDP.

What issues are you actually facing at this point? When you issue those, you should be able to get Publisher Matched (or Subscriber Matched). Then, to get the data, you need to launch the sensor_combined_listener.

@mlautman
Copy link
Author

When I run sensor_combined_listener, all I get is: Starting sensor_combined listener node... which makes sense since none of the topics are present

@TSC21
Copy link
Member

TSC21 commented Feb 26, 2019

which makes sense since none of the topics are present

What does this mean exactly? Do you get "matches" when you start the micrortps client and agent?

@mlautman
Copy link
Author

When I run ros2 topic list, I don't see any of the PX4 topics, just /parameter_events and /rosout

@TSC21
Copy link
Member

TSC21 commented Feb 26, 2019

When I run ros2 topic list, I don't see any of the PX4 topics, just /parameter_events and /rosout

Well that shouldn't be the first thing you have to debug. If you don't have a connection on the micrortps bridge, you won't have data on the ROS2 side.

@mlautman
Copy link
Author

For sure. Let me know if you run into the same micrortps bridge issue

@TSC21
Copy link
Member

TSC21 commented Feb 27, 2019

For sure. Let me know if you run into the same micrortps bridge issue

How are you sure this is an micrortps bridge issue?

Last time I tried this on my system (like a week ago) this was working perfectly fine.

@TSC21
Copy link
Member

TSC21 commented Feb 27, 2019

What version of PX4 are you using?

@TSC21
Copy link
Member

TSC21 commented Feb 27, 2019

Better: Can you please bring this to the #messaging channel of PX4 Slack? This is already out of scope ot this issue. Thanks

@mlautman
Copy link
Author

mlautman commented Feb 27, 2019

Better: Can you please bring this to the #messaging channel of PX4 Slack? This is already out of scope ot this issue. Thanks

For sure! I was just thinking the same thing. I just DM'd you on slack and posted in #messaging

@TSC21
Copy link
Member

TSC21 commented Feb 27, 2019

Actually, I lied. Here is how I build it 😝

In a fresh terminal, I run these commands:

       export FASTRTPSGEN_DIR=/usr/local/bin
       export ROS1_DISTRO="melodic"
       export ROS2_DISTRO="crystal"
       export ROS1_PATH="/opt/ros/$ROS1_DISTRO/setup.bash"
       export ROS2_PATH="/opt/ros/$ROS2_DISTRO/local_setup.bash"
       export ROS1_WS=$HOME/ws_ros1/
       export ROS2_WS=$HOME/ws_ros2/

       cd $ROS2_WS
       colcon build --symlink-install --packages-select ros1_bridge --cmake-force-configure --event-handlers console_direct+

Not all of the above is necessary but it works so I haven't been messing with it 🤷‍♂️

@mlautman evaluating the list above, I have to remove what I said yesterday. I don't really get how it is working. Firstly you are exporting the paths for the environments, but you are not sourcing them in any way. Also, you are not sourcing the workspace env, so that the px4_msgs become available for ros1_bridge to build. So you are basically building the ros1_bridge, but without any of the workspaces sourced.

@mlautman
Copy link
Author

mlautman commented Feb 28, 2019

My bad. I missed some lines. Here are the full instructions:

Open 3 Terminals (Terminal A, Terminal B, and Terminal C) and set these environment variables in each of them:

        export FASTRTPSGEN_DIR=/usr/local/bin
        export ROS1_DISTRO="melodic"
        export ROS2_DISTRO="crystal"
        export ROS1_PATH="/opt/ros/$ROS1_DISTRO/setup.bash"
        export ROS2_PATH="/opt/ros/$ROS2_DISTRO/local_setup.bash"
        export ROS1_WS=$HOME/ws_ros1/
        export ROS2_WS=$HOME/ws_ros2/

In Terminal A build the ROS2 repos except ros1_bridge

        source $ROS1_PATH && \
        source $ROS2_PATH && \
        cd $ROS2_WS && \
        colcon build --symlink-install --packages-skip ros1_bridge --event-handlers console_direct+

In Terminal B build the ROS1 repos with colcon

        source $ROS1_PATH && \
        cd $ROS1_WS && \
        colcon build --cmake-args --symlink-install --event-handlers console_direct+

In Terminal C

        source $ROS1_WS/install/setup.bash && \
        source $ROS2_PATH && \
        source $ROS2_WS/install/local_setup.bash

        cd $ROS2_WS
        colcon build --symlink-install --packages-select ros1_bridge --cmake-force-configure --event-handlers console_direct+

@mlautman
Copy link
Author

Note that you shouldn't have any environments being sourced in your bashrc.

@TSC21
Copy link
Member

TSC21 commented Feb 28, 2019

Note that you shouldn't have any environments being sourced in your bashrc.

Yep I know.

@TSC21
Copy link
Member

TSC21 commented Feb 28, 2019

In Terminal C

        source $ROS1_WS/install/setup.bash && \
        source $ROS2_PATH && \
        source $ROS2_WS/install/local_setup.bash

        cd $ROS2_WS
        colcon build --symlink-install --packages-select ros1_bridge --cmake-force-configure --event-handlers console_direct+

This still does not work to me....

CMake Error at CMakeLists.txt:70 (message):     
  Failed to find ROS 2 package 'diagnostic_msgs'


-- Configuring incomplete, errors occurred!
See also "/home/nuno/PX4/px4_ros_com_ros2/build/ros1_bridge/CMakeFiles/CMakeOutput.log".
--- stderr: ros1_bridge
CMake Error at CMakeLists.txt:70 (message):
  Failed to find ROS 2 package 'diagnostic_msgs'


---
Failed   <<< ros1_bridge	[ Exited with code 1 ]

Summary: 0 packages finished [4.96s]
  1 package failed: ros1_bridge
  1 package had stderr output: ros1_bridge

@TSC21
Copy link
Member

TSC21 commented Mar 20, 2019

@mlautman I was finally able to build ros1_bridge from source so this is no longer an issue.

@TSC21 TSC21 closed this as completed Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Issues regarding documentation (PX4 Devguide; User guide) fix in progress
Projects
None yet
Development

No branches or pull requests

2 participants