Skip to content

AMRNAV-5586: Wait BT node doesn't work with double values#48

Closed
papertowel123 wants to merge 4 commits intomainfrom
AMRNAV-5586
Closed

AMRNAV-5586: Wait BT node doesn't work with double values#48
papertowel123 wants to merge 4 commits intomainfrom
AMRNAV-5586

Conversation

@papertowel123
Copy link


Basic Info

Info Please fill out this column
Ticket(s) this addresses ticket
Primary OS tested on Ubuntu
Robotic platform tested on

Description of contribution in a few bullet points

wait_duration port for Wait node is an integer, so if we pass something like 1.3 or 2.42 than it will automatically cast to nearest integer value, so i changed type of this port from int to double.

Description of documentation updates required from your changes


Future work that may be required in bullet points

For Maintainers:

  • Check that any new parameters added are updated in navigation.ros.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists

@papertowel123 papertowel123 requested a review from HovorunB October 2, 2023 12:31
@HovorunB
Copy link

HovorunB commented Oct 4, 2023

The goal type that is sent to "Wait" server is nav2_msgs::action::Wait.
nav2_msgs::action::Wait::time::sec is also an integer. see

builtin_interfaces/Duration time

and
https://docs.ros2.org/galactic/api/builtin_interfaces/msg/Duration.html

I think we should also do some conversion like splitting the double value into seconds and nanoseconds

@papertowel123
Copy link
Author

The goal type that is sent to "Wait" server is nav2_msgs::action::Wait. nav2_msgs::action::Wait::time::sec is also an integer. see

builtin_interfaces/Duration time

and
https://docs.ros2.org/galactic/api/builtin_interfaces/msg/Duration.html
I think we should also do some conversion like splitting the double value into seconds and nanoseconds

will do

@papertowel123
Copy link
Author

The goal type that is sent to "Wait" server is nav2_msgs::action::Wait. nav2_msgs::action::Wait::time::sec is also an integer. see

builtin_interfaces/Duration time

and
https://docs.ros2.org/galactic/api/builtin_interfaces/msg/Duration.html
I think we should also do some conversion like splitting the double value into seconds and nanoseconds

done

@@ -1,9 +1,9 @@
#goal definition
builtin_interfaces/Duration time
Copy link

@HovorunB HovorunB Oct 6, 2023

Choose a reason for hiding this comment

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

Have you tried using the original type, but splitting the double value into two integer values for seconds and nanoseconds?
For example if we want to wait 3.5 seconds then we will do something like
goal_.time.sec = 3;
goal_.time.nanosec = int(0.5 * 10^9);

Its better to use existing ros2 interfaces when we can

Copy link
Author

Choose a reason for hiding this comment

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

oh, ok, I see what u mean

Copy link
Author

Choose a reason for hiding this comment

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

done
and also, maybe we should use macros instead of pow(10, 9)? smth like this:

#ifndef NANO
#define NANO 1000000000

Copy link

Choose a reason for hiding this comment

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

If there were more places in this file where we need this macro then it would be a good idea! But we only have one so i don't think its really necessary

Copy link

@HovorunB HovorunB left a comment

Choose a reason for hiding this comment

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

Looks good! But please test it a little with double values to check if it waits. And change the base branch from main to iron :)

@papertowel123 papertowel123 changed the base branch from main to iron October 9, 2023 07:09
@papertowel123 papertowel123 changed the base branch from iron to main October 10, 2023 11:41
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.

2 participants