Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

ROS 2 port of map_server - #1

Merged
wjwwood merged 4 commits into
ros2from
map_server_ros2_port
Mar 10, 2017
Merged

wjwwood merged 4 commits into
ros2from
map_server_ros2_port

Conversation

@wjwwood

@wjwwood wjwwood commented Mar 2, 2017 •

Copy link
Copy Markdown
Member

In this pr:

  • Did some small style fixes
  • Updated the package.xml to format 2 and fixed a few dependencies
  • Updated the CMakeLists.txt to use ament_cmake
  • Fixed the way CMake found yaml-cpp, sdl, and sdl-image
  • Use CMake version 3.5 and c++14
  • Converted to use ROS 2:
    • the map_server_image_loader shared library
    • map_server and map_saver executables
    • the image loader unit tests
    • the rostest as well
    • the crop_map Python script (to use Python3, it doesn't use ROS, also not sure what it is for)

There are still TODO's in the code for various things like:

  • use rclcpp version of Time::now() (there isn't one right now)
  • use an anonymous node name (not important right now since node names are not unique)
  • use a version of Node::get_parameter() which allows the user to specify a default value

I opened ros2/rclcpp#309 about getting a better get_paramter syntax, and if it is merged I can revert/remove d3d6c99 from this pr.

@wjwwood wjwwood added the in review Waiting for review (Kanban column) label Mar 2, 2017
@dirk-thomas

Copy link
Copy Markdown
Member

With more and more forks being made I am worried about the increase in technical debt. Some changes from this PR are not ROS 2 specific. They should in my opinion be applied upstream.


#include "map_server/image_loader.h"
#include <tf/tf.h>
#include <tf2/LinearMath/Quaternion.h>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tfoote what's the right thing to do here? Use tf_{bullet, kdl, etc...} or use bullet or kdl or eigen directly? I'd like to propose a pull request to upstream that converts this package to use tf2, but I don't know what to do for ROS 1.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My recommendation would be to add a dependency on rosdep bullet and use the btQuaternion directly. It's a strictly smaller dependency than tf. You should be able to substitute btQuaternion for tf::Quaternion and change the includet to be <btQuaternion.h> and use setEulerZYX (note the arguments are x, y, z in the RPY case and need to be reversed.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tfoote, I'll do that!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll continue to abuse tf2's internal implementation here because I don't want to add a dependency on bullet to ROS 2 right now.

@wjwwood

wjwwood commented Mar 3, 2017

Copy link
Copy Markdown
Member Author

Since the list was pretty short, I went a head an filed upstream tickets for everything I think could be proposed upstream:

I don't think we should wait very long for them to be merged, however, as I don't know how long it would take to get them merged.

@dirk-thomas

Copy link
Copy Markdown
Member

I went ahead and filed upstream tickets for everything I think could be proposed upstream

👍 Thanks.

I don't think we should wait very long for them to be merged, however, as I don't know how long it would take to get them merged.

Absolutely. We can always rebase our fork when they get merged in the future.

@wjwwood

wjwwood commented Mar 10, 2017

Copy link
Copy Markdown
Member Author

Does anyone have time to review these changes with the intent to merge it? I've gotten some comments, but no affirmative +1 for merging.

@Karsten1987

Copy link
Copy Markdown

It basically looks good to me, but I have a few questions:

  • since you modified the code already quite a bit, does it make sense to run the linters on it? With this, at least our code base had the same style all the way through.
  • does it compile on windows? If so, how do you handle dependencies such as yaml-cpp and sdl?

@dirk-thomas

dirk-thomas commented Mar 10, 2017 •

Copy link
Copy Markdown
Member

+1 for the current change. But before we convert more and more packages from catkin to ament_cmake I would suggest to work on a CMake abstraction API to not repeat this effort over and over again.

@wjwwood

wjwwood commented Mar 10, 2017 •

Copy link
Copy Markdown
Member Author

since you modified the code already quite a bit, does it make sense to run the linters on it? With this, at least our code base had the same style all the way through.

My understanding was that our goal was to keep upstream and the ports as similar as possible so that rebasing and getting patches from upstream was easier. So I explicitly did not do run the linters on it. I think that makes sense, but if we decided to do differently as a group then I'll update the pr.

does it compile on windows? If so, how do you handle dependencies such as yaml-cpp and sdl?

Probably not, but I haven't tried it. My intention was to only run it in the "Linux and macOS"-only job for the turtlebot demo that @dhood was setting up.

But before we convert more and more packages from catkin to ament_cmake I would suggest to work on a CMake abstraction API to not repeat this effort over and over again.

What exactly do you mean?

@dirk-thomas

Copy link
Copy Markdown
Member

But before we convert more and more packages from catkin to ament_cmake I would suggest to work on a CMake abstraction API to not repeat this effort over and over again.

What exactly do you mean?

I don't think the CMake code of every package should be completely changed to use ament_cmake directly. This on its own is already a big diversion from upstream and also requires effort. I think instead only minimal changes should be done (e.g. adding a new call like catkin_package_fini at the end). A to be created catkin ROS 2 package should provide the same API as catkin in ROS 1 and call ament_cmake under the hood.

@codebot

codebot commented Mar 10, 2017

Copy link
Copy Markdown
Member

Having a catkin package in ROS 2 would be extremely awesome! How hard would it be to throw together a prototype that covers just enough functionality to handle the few packages we're talking about at the moment? It could always be improved in the future, and an initial version of this would be incredibly useful.

@dirk-thomas

Copy link
Copy Markdown
Member

@codebot It has been on the list of ideas for a long time and has recently been mentioned for the roadmap. It is just a matter of priorities. I think considering that we want to "reuse" (I am trying to avoid the word migrate here) several ROS 1 packages it would be very useful.

@codebot

codebot commented Mar 10, 2017

Copy link
Copy Markdown
Member

Yeah I don't have an ideal grasp of the tradeoff in terms of time/effort between creating a catkin package for ROS 2 versus creating branched versions of the CMake files in the few packages we're talking about at the moment, and I certainly don't want to derail or slow down progress. I assume if we are estimating the time required for creating N different CMake files on ros2 branches in a few packages, it would be easier to make a caktin package for ROS 2 instead, but I don't know where exactly where the cutoff point is between those two strategies. I'm always in favor of forging ahead on whatever path makes reasonable sense at the moment. I was just curious since my cmake skills are... not impressive 😄

@wjwwood

wjwwood commented Mar 10, 2017

Copy link
Copy Markdown
Member Author

Ok, I'm going to merge this with the existing feedback, considering that it isn't in the default .repos file right now. I tested it locally, but it can be further tested once there is a new job to handle these higher level packages.

@wjwwood
wjwwood merged commit a189cd9 into ros2 Mar 10, 2017
@wjwwood
wjwwood deleted the map_server_ros2_port branch March 10, 2017 23:44
@wjwwood wjwwood removed the in review Waiting for review (Kanban column) label Mar 10, 2017
allenh1 pushed a commit that referenced this pull request Aug 1, 2017
* remove AMENT_IGNORE and vestigial files

* style fixes, trailing whitespace and typos

* port to ROS 2

* use existing rclcpp syntax for now
allenh1 pushed a commit that referenced this pull request Aug 1, 2017
* remove AMENT_IGNORE and vestigial files

* style fixes, trailing whitespace and typos

* port to ROS 2

* use existing rclcpp syntax for now
mikaelarguedas pushed a commit that referenced this pull request May 24, 2018
* remove AMENT_IGNORE and vestigial files

* style fixes, trailing whitespace and typos

* port to ROS 2

* use existing rclcpp syntax for now

fix package.xml (#2)

use updated rclcpp syntax for get_parameter_or (#4)

Export map_server libraries (#7)

* Export libraries

* Use name of library

* ament_export_libraries takes list of strings

* Revert "ament_export_libraries takes list of strings"

This reverts commit 630312b.

Switch use of rcl_system_time_now to rcutils_system_time_now. (#8)

Signed-off-by: Chris Lalancette <[email protected]>

Port AMCL to ROS 2 (and tf2) (#9)

* Remove dynamic reconfigure

* Remove rosbag functionality

* Remove message filter use

* tf -> tf2

* Strip leading / from frame IDs

* Re-enable message filter

* Don't use deperecated quaternion constructor

* Revert "Re-enable message filter"

This reverts commit c4160c2.

* Fix test failures by increasing transform timeouts

* WIP ros1->ros2

* Namespace of ::msg or ::srv

* ConstPtr -> ::ConstPtr

* ros::Time -> tf2::TimePoint

* ros::Duration -> tf2::Duration

* ros -> rclcpp

* ros2 timer

* Disable sigint handler

* Not using boost::shared_ptr

* Appropriate boost header for recursive_mutex

* Shared ptrs everywhere

* Use new durationFromSec tf2 function

* Subscribers using qos settings

* Leftover missing ::msg

* Use new tf2_ros::fromMsg

* Reinstate node ptr

* Disable most logging

* chrono fix

* 'msg.' -> 'msg->'

* Store node

* Create services properly

* Set parameters

* Comment more logging

* tf2 fixes

* fix service callback signatures

* tf2 changes

* misc

* only callbacks use shared_ptr

* map request service

* Fix boost link error

* Comment these for now just to move forward

* Use ament_auto_package

* tf2::Duration -> tf2::durationFromSec

* Re-enable "logging"

* Prevent node already added to executor crash

* (hack) use 'latest' TF info

* Debug

* Fixup (whitespace etc)

* Use rate for map request

* Don't use tf2 time for checkLaserReceived timer

* Clarify which TODOs are for before merge

* Add wait_for_service

* Restore initial qos choices

* Restore tolerance

* Demo ROS 1 launch file to be used with bridge

* [hack] Use map from topic instead of service

* Remove debug prints

* It probably won't be the map server publishing the map topic in that case (or we'd use the service)

* Expose use_map_topic as command line option

* Put initial pose back to 0 (can be set on 'initialpose' topic)

* Use tf2 time because ROS times can't be subtracted a.t.m.

* Revert test tolerance increase (needed for use without message filters)

* Remove commented delete that will never be re-enabled

* Tidy up workaround for 'latest' TF data

If the timestamp of the requested transform is 0 it will get latest

* Remove most workarounds for 'latest' TF data

* Prevent unused variable warnings

* Remove boost dependency

* Use CMAKE_CXX_STANDARD

* Alphabetical ordering

* Whitespace fixup

* Leftover debug prints

* Restore original default d_thresh

* Revert "Prevent unused variable warnings"

This reverts commit e624b1f.

* Prevent unused variable warnings

* Let ament_cmake_ros have control over the BUILD_SHARED_LIBS cmake flag

* Pedantic is a bit much

* simplify ament_target_dependencies call

* Correct usage of ament_target_dependencies

* Remove custom leading forward slash removal

Not necessary in ROS 2

* Remove ROS 1 testing launch file

* Avoid race condition with map_server topic usage

Issue with large services using fastrtps

use CMAKE_X_STANDARD and check compiler rather than platform

Remove dependency on rostest. (#10)

amcl integration: best effort QoS for laser scan subscription (#11)

* Make laser subscription best effort

Otherwise it can't subscribe to best effort publishers (and is generally more appropriate)

* Use rcutils logging macros

* Start a parameter server for external nodes to interact with

* Reduce diff with upstream

Move map server executables to libexec directory (#12)

use new namespace (#13)

Exporting the map_server include directory (#14)

disable everything for now with AMENT_IGNORE files

ROS 2 port of map_server (#1)

* remove AMENT_IGNORE and vestigial files

* style fixes, trailing whitespace and typos

* port to ROS 2

* use existing rclcpp syntax for now

fix package.xml (#2)

use updated rclcpp syntax for get_parameter_or (#4)

Switch use of rcl_system_time_now to rcutils_system_time_now. (#8)

Signed-off-by: Chris Lalancette <[email protected]>

Port AMCL to ROS 2 (and tf2) (#9)

* Remove dynamic reconfigure

* Remove rosbag functionality

* Remove message filter use

* tf -> tf2

* Strip leading / from frame IDs

* Re-enable message filter

* Don't use deperecated quaternion constructor

* Revert "Re-enable message filter"

This reverts commit c4160c2.

* Fix test failures by increasing transform timeouts

* WIP ros1->ros2

* Namespace of ::msg or ::srv

* ConstPtr -> ::ConstPtr

* ros::Time -> tf2::TimePoint

* ros::Duration -> tf2::Duration

* ros -> rclcpp

* ros2 timer

* Disable sigint handler

* Not using boost::shared_ptr

* Appropriate boost header for recursive_mutex

* Shared ptrs everywhere

* Use new durationFromSec tf2 function

* Subscribers using qos settings

* Leftover missing ::msg

* Use new tf2_ros::fromMsg

* Reinstate node ptr

* Disable most logging

* chrono fix

* 'msg.' -> 'msg->'

* Store node

* Create services properly

* Set parameters

* Comment more logging

* tf2 fixes

* fix service callback signatures

* tf2 changes

* misc

* only callbacks use shared_ptr

* map request service

* Fix boost link error

* Comment these for now just to move forward

* Use ament_auto_package

* tf2::Duration -> tf2::durationFromSec

* Re-enable "logging"

* Prevent node already added to executor crash

* (hack) use 'latest' TF info

* Debug

* Fixup (whitespace etc)

* Use rate for map request

* Don't use tf2 time for checkLaserReceived timer

* Clarify which TODOs are for before merge

* Add wait_for_service

* Restore initial qos choices

* Restore tolerance

* Demo ROS 1 launch file to be used with bridge

* [hack] Use map from topic instead of service

* Remove debug prints

* It probably won't be the map server publishing the map topic in that case (or we'd use the service)

* Expose use_map_topic as command line option

* Put initial pose back to 0 (can be set on 'initialpose' topic)

* Use tf2 time because ROS times can't be subtracted a.t.m.

* Revert test tolerance increase (needed for use without message filters)

* Remove commented delete that will never be re-enabled

* Tidy up workaround for 'latest' TF data

If the timestamp of the requested transform is 0 it will get latest

* Remove most workarounds for 'latest' TF data

* Prevent unused variable warnings

* Remove boost dependency

* Use CMAKE_CXX_STANDARD

* Alphabetical ordering

* Whitespace fixup

* Leftover debug prints

* Restore original default d_thresh

* Revert "Prevent unused variable warnings"

This reverts commit e624b1f.

* Prevent unused variable warnings

* Let ament_cmake_ros have control over the BUILD_SHARED_LIBS cmake flag

* Pedantic is a bit much

* simplify ament_target_dependencies call

* Correct usage of ament_target_dependencies

* Remove custom leading forward slash removal

Not necessary in ROS 2

* Remove ROS 1 testing launch file

* Avoid race condition with map_server topic usage

Issue with large services using fastrtps

use CMAKE_X_STANDARD and check compiler rather than platform

Remove dependency on rostest. (#10)

amcl integration: best effort QoS for laser scan subscription (#11)

* Make laser subscription best effort

Otherwise it can't subscribe to best effort publishers (and is generally more appropriate)

* Use rcutils logging macros

* Start a parameter server for external nodes to interact with

* Reduce diff with upstream

Move map server executables to libexec directory (#12)

use new namespace (#13)

Exporting the map_server include directory (#14)

Fixed GCC 8.0 compiler warning.

Fix compilation, as well as remove more warnings.

Fix GCC 8 warnings for map_server.

Add rcutils debug macros to map_server. (#18)

* Add rcutils debug macros to map_server.

* Addresses comments by @wjwwood

* Updated package.xml and CMakeLists.txt to add rcutils dependency.

* Remove ';' from the ends of macro calls.

* Address comments by @mikaelarguedas

Remove extra newline (#19)

use ament_cmake_pytest instead of ament_cmake_nose (#22)

Make amcl compile again with the recent changes to rclcpp::Time. (#23)

* Make amcl compile again with the recent changes to rclcpp::Time.

Signed-off-by: Chris Lalancette <[email protected]>

* Initialize the timesource and clock in the AmclNode constructor.

Then just call "clock->now()" where we need it.

Signed-off-by: Chris Lalancette <[email protected]>

* Remove rclcpp_now completely.

Signed-off-by: Chris Lalancette <[email protected]>

* Fix to not pass node to clock->now

Signed-off-by: Chris Lalancette <[email protected]>

* Change ts -> timesource.

Signed-off-by: Chris Lalancette <[email protected]>

looks like logging is initialized automatically now, fixes warning (#24)

Update for rclcpp namespace removals (#25)

* Remove client:: namespace

* Remove service:: namespace

* Remove parameter_service:: namespace

* Remove rate:: namespace

* Remove node:: namespace

Update maintainers and version ahead of Ardent release (#26)

* Update maintainers and version ahead of Ardent release

* Prev maintainers -> authors

* Level all versions so bloom doesn't complain
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants