-
Notifications
You must be signed in to change notification settings - Fork 864
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
ROS2 Navsat_transform_node in Dashing #476
ROS2 Navsat_transform_node in Dashing #476
Conversation
Please see my notes on that issue. |
It now compiles with navsat_transform_node. However there is one major issue, trying to run I get problems with the dynamically linked stuff:
Which is really strange, because I couldn't see anything in particular in the CMakeLists file that would make a hard dependency on anything from connext (as it is an optional middleware). I'll continue my research, but any input on that is welcome :). However I think its ready for some major PR feedback now. Edit: Fixed! |
find_package(ament_cmake REQUIRED) | ||
find_package(rclcpp REQUIRED) | ||
#find_package(geographic_msgs REQUIRED) | ||
find_package(geographic_msgs REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to see this was released.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's released yet though. I saw the comment in the issue. Right now it needs to be cloned manually and activate that workspace. This is kind of important as well ros-geographic-info/geographic_info#26 which hasn't been approved yet :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uh, then we cant merge this @klintan, it'll not build in CI or on releasing debians
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, I'll try to push to get the geographic_msgs released, maybe we can keep this PR open until then (hopefully won't be months) and as soon as it's there, this will be mergeable.
edit: Sidenote, recently ROS2 converted ros-driver package for velodyne depends on the angles
package https://github.com/ros/angles.git which is also not a part of the official release yet. But I get that different packages see this differently (of course regardless the geographic_info package at least needs the latest fixes in the ros2 branch)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sigh ok, now, weeks later, I have lobbied all the parties required to merge the ROS2 port PR, it will be released in the next dashing sync assuming I didnt mess it up. But now I have a new shiny GitHub organization on my profile, so not a total loss of time :-)
ros/rosdistro#22324
I'm experiencing these issues as well with an unrelated package. I suspect this is caused by something upstream. |
Let me know if you find the/a solution, I'm going to try just removing the dynamic links using otool/install_name_tool . I'll let you know if I figure it out. @rotu the issue was indeed upstream, it seems that geographic_msgs was exporting all of these dependencies
Removing all of them except |
To test this PR, I made a vcstools file to include the unreleased upstream dependencies and open PR's:
repositories:
diagnostics:
type: git
url: git@github.com:ros/diagnostics.git
version: ros2-devel
geographic_info:
type: git
url: git@github.com:PickNikRobotics/geographic_info.git
version: unique_identifier_msgs
robot_localization:
type: git
url: git@github.com:klintan/robot_localization.git
version: dashing-devel After installing ROS Dashing, and
|
The - <!--<depend>geographic_msgs</depend>-->
+ <depend>geographic_msgs</depend> |
That's awesome, thanks! |
Wow, thanks for all the effort here. I'll keep an eye out for the Dashing sync and merge afterwards, assuming nothing else needs to be done here. |
I still see some issues, will do another pass through this afternoon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Biggest issues around the queue_size & ros2 conventions
@@ -35,6 +39,7 @@ include_directories( | |||
include |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to point you to one of my other packages for ros2 cmakelist best practices, this is really not easily maintainable with all the include / link dirs. If you set a variable with all the dependencies and you use ament, you can get rid of most of this code.
https://github.com/ros-planning/navigation2/blob/master/nav2_planner/CMakeLists.txt
@@ -57,7 +57,7 @@ class NavSatTransform | |||
/** | |||
* @brief Constructor | |||
*/ | |||
NavSatTransform(); | |||
NavSatTransform(std::shared_ptr<rclcpp::Node> node); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best practices for this is that the NavSatTransform node should derive from rclcpp::Node, and when you make the shared_ptr of it in main
that will deal with this, then all of your calls are working with methods available vs storing your node_
. The ros nodehandle methodology is depreciated in ros2, its preferred to derive from the node to best make use of lifecycle and components, which is important for this package in particular
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually tried to use that convention here as well, but I couldn't get it to work, always got the bad_weak_ptr exception during runtime because of the TF2 package (I think). The initializer lists wants a shared, and since there is now owner when it's passed I got that exception. However it could have been the way I used image_transport the "old" way, instead of the image_transport::create_subscription/create_publisher
that made it fail, I can't fully recall I'll need to retest it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you make_shared
the NavSatTransform object in main
that will fix that. You get an issue with shared_ptrs if there's not already the reference counter set
I thought some of the changes from the last PR was going to conflict with this one? Regardless I'll try to adopt the same style as that one for some of the changes here as well (and of course all of the review remarks) Thanks for the very thorough review, I appreciate it and I appreciate your patience. |
I think some of my colleagues would use another, less kind, word in its place, but thanks for baring with me 😸 |
Fixed a bunch of stuff, I will give the inherit from |
@SteveMacenski Now compiling and working using the ROS2 node-style. Made most of the std::outs to RCLCPP style logging. On of the old std::outs outputted the pose though, which is kind of tricky to log using RCLCPP style. I don't think that one is necessary though, but maybe long term for debugging purposes/brevity we want to get it in there. Let me know if you find anything, any and all feedback is welcome :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small fish changes needed
src/navsat_transform.cpp
Outdated
rclcpp::Rate rate(frequency); | ||
while (rclcpp::ok()) { | ||
rclcpp::spin_some(node_); | ||
int interval = (1/frequency) * 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have frequency defaulted to 10
, so this would be... 100 hz? I think you mean to move s
to ms
but the variable name didnt make that clear, can you change the name or do the ms conversion in the chrono call? Or better yet, use chrono::seconds(interval)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good catch. I'll keep the variable name, but I like the approach of chrono::seconds(interval)
to make it more clear.
@SteveMacenski fixed the things you noted (I hope :) ). However I noticed another issue when fixing that, line 954 in ros_filter.cpp (same thing in 2 other places in ros_filter), perhaps you can take an extra look at that so it looks sane. I'm open to any other approach. Sorry for the delay. |
Hello @klintan, I've been using your "beta version" of the navsat_transform node, and I found a problem when using a dual_ekf_navsat configurations, a local ekf node and a global ekf node with GPS (following the yaml below: dual_ekf_navsat_example.yaml SO here is the problem, the navsat_transform node subscribes to "/odometry/filtered" topic msgs, and because both "ekf_se_odom"(local) node and "ekf_se_map"(global) node will publish "/odometry/filtered" topic msg, it will cause the "/odometry/gps" topic msg published by navsat_transform node jump between 2 values, each calculated based on the msg published by "ekf_se_odom"(local) node or and "ekf_se_map"(global) node, respectively.
But anyway I've made a workaround, by only executing "odomCallback" function when the frame_id of the "/odometry/filtered" msg header eqauls to "map"(i.e. published by "ekf_se_map"(global) node). I'm wondering that whether I'm not correctly using the "dual_ekf_navsat" configurations with GPS info, or is there a better solution for this problem? Thanks! |
@reso1, the two EKFs should not be publishing on the same topic. Remap the tier 1 (odom) frame one to something else. |
@klintan I’ll take a look this afternoon. I (still, frustratingly, annoyingly, {other more colorful words}) do not have a robot to meaningfully test this on, so by in large I’m trusting beyond the code semantics that this actually works. I’m not sure if Tom has a ROS2-able robot to have a quick third party check, or @reso1 other than your topic remapping (see Tom’s comment), is this working for you? Have you tried all the params getting to you & outputs as expected? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Themes:
- still need queue sizes
- A few more updates to CMakeList still necessary
- Member variable naming
- Just making sure defaults are same as in ROS1
CMakeLists.txt
Outdated
@@ -19,37 +23,60 @@ find_package(tf2_geometry_msgs REQUIRED) | |||
find_package(tf2_ros REQUIRED) | |||
find_package(Eigen3 REQUIRED) | |||
|
|||
set(includes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't necessary anymore, use ament_target_dependencies
see examples here https://github.com/ros-planning/navigation2/blob/master/nav2_planner/CMakeLists.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm I think I might have missed something, because couldn't get it to find some includes (eigen3 and diagnostics_updated without adding them).
See my changes, I think I need some help on that one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure let me know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of everything I'm the least concerned by the CMake stuff, give it another shot and if not I can take care of it for you after the fact
src/ros_filter.cpp
Outdated
@@ -1436,7 +1445,7 @@ void RosFilter::loadParams() | |||
deceleration_gains); | |||
|
|||
control_sub_ = node_->create_subscription<geometry_msgs::msg::Twist>( | |||
"cmd_vel", | |||
"cmd_vel", 10, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
queue size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter would be outside the scope of odom, twist, pose and imu. Do we want to declare a separate parameter for this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry this one is fine. I went a little trigger happy when I saw the number 10
😉 Though I think 1
is also the ROS1 default, if you see how its used, there's no benefit to storing anything except the most recent one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha :) ok I'll change this to 1 as well.
@ayrton04 @SteveMacenski |
Happy to hear it's working for you :) |
Wow that was quick, ok I think the last thing is just the conversation on the parameters for checking I'm not buying this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With that, I give this my (fairly meaningless) thumbs up.
Lets see what Tom says on the undeclare
thing. Otherwise, assuming that you've sufficiently tested this since it doesn't appear the automated testing pipeline is in good shape, I would be OK merging this.
Thanks with sticking with my rounds-and-rounds of nitpicks
src/ros_filter.cpp
Outdated
@@ -1849,11 +1881,11 @@ void RosFilter::run() | |||
|
|||
double diag_duration = (cur_time - last_diag_time).nanoseconds(); | |||
if (print_diagnostics_ && | |||
(diag_duration >= diagnostic_updater_.getPeriod() || | |||
diag_duration < 0.0)) | |||
(diag_duration >= diagnostic_updater_.getPeriod() || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diagnostic_updater_.getPeriod().nanoseconds()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getPeriod() is already returning nanoseconds :)
edit: as seen below, I didn't have the latest diagnostics_updater, thanks for pointing this out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am looking at the diagnostic repo, and getPeriod() returns a rcl_duration_value_t
in the head of the crystal branch , but returns a rclcpp::Duration
at the head of the dashing branch. rclcpp::Duration
does need a .nanoseconds()
to get the types matching
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like the type change came in with c272eb276d
of the diagnostic repo dashing branch and is in the released debian for dashing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aah ok, yes I did not pull the absolute latest, I'll do that and re-run. I think the one I had was at least dashing, so maybe that commit was aimed at one of the patch-releases.
Thanks for your patience, took a while to knock it out. Fixed a bunch of linting issues that failed in the tests. Let me know if you see anything I missed after/during the rebase. |
@Jconn are your concerns resolved? |
I dont believe it. Its finally in! |
Epic. Thanks to everyone involved! |
I saw there was already an issue and a fork (#473) for Dashing, but made some changes remove all the deprecation warnings.
There might be some
declare_parameters
which could go back toget_parameter
.Also I guess it makes sense to create a new branch dashing-devel and if these changes makes sense, I'll change the PR to that branch instead.