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

Fix: ROS install space #11365

Closed
wants to merge 8 commits into from
Closed

Fix: ROS install space #11365

wants to merge 8 commits into from

Conversation

TSC21
Copy link
Member

@TSC21 TSC21 commented Feb 1, 2019

Describe problem solved by the proposed pull request
Inside a ROS context, there are currently two distinctive ways we can build packages inside a workspace: using catkin tools or using colcon. While the first one supports a devel space, the second one doesn't and installs the project according to the directives on the CMakeLists.txt files.

So, while using catkin tools, the solution would work as expected, since everything will be set and under a devel space, when using an install space, things wouldn't work properly, as we are not installing the required files onto the expected directories.

Describe your preferred solution
The solution was to get into the posix platform build structure, specifically for the sitl target, and rearrange the install dirs, in a way that they match the expected organisation for a ROS workspace. While this continues to work in a normal raw CMake build, the current install dirs also allow it to work inside a ROS workspace.

Additional context
To test it, one can use and install colcon on his system (assuming that you have ROS installed already). If you are under a ROS 1 context:

$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
$ sudo apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116
$ sudo apt update
$ sudo apt install python3-colcon-common-extensions

Then, to build PX4 under a ROS1 workspace:

$ mkdir -p colcon_ws/src
$ cd colcon_ws/src
$ git clone --recursive https://github.com/PX4/Firmware
$ ln -s Firmware/Tools/sitl_gazebo mavlink_sitl_gazebo
$ colcon build --event-handlers console_direct+

The above can also be tested using catkin by setting an install space: catkin config --install.

Then, to test if it works, first source your workspace using source install/local_setup.bash (or setup.bash for the catkin case). Then, try running one of the launch files: roslaunch px4 mavros_posix_sitl.launch. If all was properly set, the Gazebo simulation with PX4 SITL and MAVROS will launch as they should.

@TSC21 TSC21 added bug Sim: SITL software in the loop simulation Sim: gazebo classic Gazebo classic simulator MAVROS labels Feb 1, 2019
@TSC21 TSC21 self-assigned this Feb 1, 2019
@TSC21 TSC21 requested review from dagar and jgoppert February 1, 2019 23:47
@TSC21
Copy link
Member Author

TSC21 commented Feb 1, 2019

Just need to fix now the path for test on CI and all should be good.

@TSC21 TSC21 requested a review from lamping7 February 1, 2019 23:57
@TSC21 TSC21 force-pushed the fix/ros_install_space branch from 83db146 to 6580ecd Compare February 2, 2019 00:18
@LorenzMeier
Copy link
Member

CI still fails.

@TSC21
Copy link
Member Author

TSC21 commented Feb 3, 2019

Yep:

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >'

  what():  boost: mutex lock failed in pthread_mutex_lock: Invalid argument

Aborted (core dumped)

This is happening on the rostest. I have no idea of what's causing this. Locally the test is failing as well, though it doesn't through the above error. Have to dig in.

@dagar
Copy link
Member

dagar commented Feb 3, 2019

I think we need to clarify the desired install and run directories.

What do we need to install and where?

  • px4 binary
  • px4 cmd aliases
  • px4 ROMFS (rcS, airframes, and mixers)
  • misc scripts, models, tools
    Where do the temporary pieces go?
  • parameters, dataman, logs, etc

How does this change within ROS (catkin or colcon)?

https://wiki.archlinux.org/index.php/XDG_Base_Directory

@TSC21
Copy link
Member Author

TSC21 commented Feb 3, 2019

@dagar I just explained above how this changes in catkin and colcon.

@TSC21
Copy link
Member Author

TSC21 commented Feb 3, 2019

Here's how a catkin workspace is organized: http://wiki.ros.org/catkin/workspaces.
Colcon will build the package as a standard CMake build, but for usage in ROS1, it totally depends on how you organize the install structure. The problem doesn't occur when you build it using catkin tools because it is created a devel space. But when building with colcon, everything gets installed, so to use it as if it was in a ROS workspace, you need to place the binaries and required tools under the shared folder.

@dagar
Copy link
Member

dagar commented Feb 3, 2019

@dagar I just explained above how this changes in catkin and colcon.

Yes I know, but what I'm talking about is taking a step back to make sure the basics are in place first so we stop playing issue whack-a-mole. Throwing everything into share like this just isn't right.

@TSC21
Copy link
Member Author

TSC21 commented Feb 3, 2019

I am not saying that throwing everything into share is the solution. But something has to go there eventually.

@TSC21
Copy link
Member Author

TSC21 commented Feb 14, 2019

@dagar what do you suggest to be done in order this gets solved? We need to eventually bring something under share folder so the installed stuff gets solved and sourced properly in a ROS environment. I am not saying all should go to share, but at least the package.xml, launch files and the PX4 bin file.

@TSC21
Copy link
Member Author

TSC21 commented Mar 9, 2019

@dagar please let me know how do you want to proceed with this. I am ok on discussing this on a call. Thanks

@stale
Copy link

stale bot commented Jul 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Oct 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale label Oct 23, 2019
@TSC21
Copy link
Member Author

TSC21 commented Oct 23, 2019

Still needs discussion.

@stale stale bot removed the stale label Oct 23, 2019
@stale
Copy link

stale bot commented Jan 21, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale label Jan 21, 2020
@TSC21 TSC21 removed the stale label Jan 21, 2020
@TSC21
Copy link
Member Author

TSC21 commented Jan 21, 2020

This needs discussion but let's close it for now. I will get back to it later.

@TSC21 TSC21 closed this Jan 21, 2020
@mkhansenbot
Copy link

I'm running into the same install issue that this is designed to fix, any chance we can revisit this?

@LorenzMeier LorenzMeier deleted the fix/ros_install_space branch January 18, 2021 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Discussion (needed) 💬 MAVROS Sim: gazebo classic Gazebo classic simulator Sim: SITL software in the loop simulation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants