AMRNAV-5586: Wait BT node doesn't work with double values#48
AMRNAV-5586: Wait BT node doesn't work with double values#48papertowel123 wants to merge 4 commits intomainfrom
Conversation
|
The goal type that is sent to "Wait" server is 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 |
done |
| @@ -1,9 +1,9 @@ | |||
| #goal definition | |||
| builtin_interfaces/Duration time | |||
There was a problem hiding this comment.
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
There was a problem hiding this comment.
done
and also, maybe we should use macros instead of pow(10, 9)? smth like this:
#ifndef NANO
#define NANO 1000000000
There was a problem hiding this comment.
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
HovorunB
left a comment
There was a problem hiding this comment.
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 :)
Basic Info
Description of contribution in a few bullet points
wait_durationport forWaitnode 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 frominttodouble.Description of documentation updates required from your changes
Future work that may be required in bullet points
For Maintainers: