Skip to content

Conversation

@jacobperron
Copy link
Contributor

Building against the latest version of rclcpp produces some deprecation warnings. This PR fixes warnings related to rclcpp::Duration construction (6b36efd) and rclcpp::Node::declare_parameter (7055b82).

Related tickets upstream, deprecating usage:

The second commit (7055b82) related to declare_parameter is not compatible with Foxy, so I recommend creating a new galactic-devel branch and we can retarget this PR.

If we are constructing from nanoseconds we must be explicit about the units.

Signed-off-by: Jacob Perron <[email protected]>
If a default value is not provided, then we must specify the parameter type.

Signed-off-by: Jacob Perron <[email protected]>
first_measurement->topic_name_;
// revertTo may invalidate first_measurement
if (!revertTo(first_measurement_time - rclcpp::Duration(1))) {
if (!revertTo(first_measurement_time - rclcpp::Duration(1ns))) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@ayrton04 should this be 1ns, 1s, ...?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I meant to ask the same question.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I understand the equivalent ROS 1 code, it is also subtracting 1 nanosecond:

if (!revertTo(firstMeasurementTime - 1e-9)) // revertTo may invalidate firstMeasurement

Copy link
Collaborator

Choose a reason for hiding this comment

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

So the PRs involved here are

https://github.com/cra-ros-pkg/robot_localization/pull/266/files

and

https://github.com/cra-ros-pkg/robot_localization/pull/279/files

The only reason we subtract any time at all is to ensure that we go to a measurement (presumably the first) that is before first_measurement_time. But we could also just change this to use >=:

while (!filter_state_history_.empty() &&
filter_state_history_.back()->last_measurement_time_ > time)

If I had to guess (I didn't dig too far), the measurement times were likely stored as doubles originally, and the 1e-9 thing was just me being careful with floating point numbers. But ROS times have exact representations, so I think the 1e-9 could go, and we can change the revertTo reverse iteration to check for >= instead of just >.

Copy link
Collaborator

Choose a reason for hiding this comment

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

However, that change could be outside of scope for this. It was meant to be 1 nanosecond, yes.

@SteveMacenski
Copy link
Collaborator

@jacobperron I opened a ros2 branch to target it to since those from_XYZ's aren't in foxy

@jacobperron jacobperron changed the base branch from foxy-devel to ros2 March 17, 2021 22:53
Signed-off-by: Jacob Perron <[email protected]>
@jacobperron
Copy link
Contributor Author

Hold up, there's more warnings in other files I've overlooked.

@jacobperron
Copy link
Contributor Author

Hold up, there's more warnings in other files I've overlooked.

Okay, I think I got them all.

@SteveMacenski
Copy link
Collaborator

Otherwise LGTM, waiting for Tom's response on that one comment

Signed-off-by: Jacob Perron <[email protected]>
When there is a NoParameterOverrideProvided exception, the parameter
is not declared so we don't need to undeclare it.

Signed-off-by: Jacob Perron <[email protected]>
@ayrton04 ayrton04 requested a review from SteveMacenski March 22, 2021 10:20
@ayrton04
Copy link
Collaborator

@SteveMacenski, feel free to merge. I know you said LGTM, but your review still had comments requested, so I re-requested your review.

@SteveMacenski SteveMacenski merged commit 9fba3e8 into cra-ros-pkg:ros2 Mar 22, 2021
@jacobperron jacobperron deleted the fix_deprecation_warnings branch March 22, 2021 18:48
SteveMacenski pushed a commit that referenced this pull request May 21, 2021
Try-catches were added in #631 due to a new rclcpp feature enforcing static parameter.
The behavior was later patched for this particular use-case in ros2/rclcpp#1673, so now we can avoid having to try-catch.

Signed-off-by: Jacob Perron <[email protected]>
SteveMacenski pushed a commit that referenced this pull request May 24, 2021
Try-catches were added in #631 due to a new rclcpp feature enforcing static parameter.
The behavior was later patched for this particular use-case in ros2/rclcpp#1673, so now we can avoid having to try-catch.

Signed-off-by: Jacob Perron <[email protected]>
SteveMacenski added a commit that referenced this pull request May 24, 2021
* Add missing message_filters dependency (#666)

Headers from message_filters are included here:
https://github.com/cra-ros-pkg/robot_localization/blob/67098c2341b5d1ccbcceb8eede60e79db74814a6/include/robot_localization/ros_robot_localization_listener.h\#L41-L42

Signed-off-by: Jacob Perron <[email protected]>

* Remove try-catch blocks around declare_parameter (#663)

Try-catches were added in #631 due to a new rclcpp feature enforcing static parameter.
The behavior was later patched for this particular use-case in ros2/rclcpp#1673, so now we can avoid having to try-catch.

Signed-off-by: Jacob Perron <[email protected]>

Co-authored-by: Jacob Perron <[email protected]>
SteveMacenski pushed a commit that referenced this pull request May 25, 2021
* Remove try-catch blocks around declare_parameter (#663)

Try-catches were added in #631 due to a new rclcpp feature enforcing static parameter.
The behavior was later patched for this particular use-case in ros2/rclcpp#1673, so now we can avoid having to try-catch.

Signed-off-by: Jacob Perron <[email protected]>

* Add missing message_filters dependency (#666)

Headers from message_filters are included here:
https://github.com/cra-ros-pkg/robot_localization/blob/67098c2341b5d1ccbcceb8eede60e79db74814a6/include/robot_localization/ros_robot_localization_listener.h\#L41-L42

Signed-off-by: Jacob Perron <[email protected]>

* Revert "Enable QoS overrides (#657)"

This reverts commit 2816e92.

Co-authored-by: Jacob Perron <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants