Giter VIP home page Giter VIP logo

Comments (26)

mlautman avatar mlautman commented on July 24, 2024 1

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 🤷‍♂️

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

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?

from px4_ros_com.

mlautman avatar mlautman commented on July 24, 2024

I have tested with both bouncy and crystal

from px4_ros_com.

mlautman avatar mlautman commented on July 24, 2024

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

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

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.

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

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).

from px4_ros_com.

mlautman avatar mlautman commented on July 24, 2024

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.

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

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

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

@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.

from px4_ros_com.

mlautman avatar mlautman commented on July 24, 2024

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

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

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.

from px4_ros_com.

mlautman avatar mlautman commented on July 24, 2024

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

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

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?

from px4_ros_com.

mlautman avatar mlautman commented on July 24, 2024

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

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

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.

from px4_ros_com.

mlautman avatar mlautman commented on July 24, 2024

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

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

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.

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

What version of PX4 are you using?

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

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

from px4_ros_com.

mlautman avatar mlautman commented on July 24, 2024

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

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

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.

from px4_ros_com.

mlautman avatar mlautman commented on July 24, 2024

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+

from px4_ros_com.

mlautman avatar mlautman commented on July 24, 2024

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

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

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

Yep I know.

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

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

from px4_ros_com.

TSC21 avatar TSC21 commented on July 24, 2024

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

from px4_ros_com.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.