Skip to content

Commit afd89b0

Browse files
committed
mission: rename delay argument to duration for hold action
And add a check to exclude ^internal:* from action arguments
1 parent bbf2927 commit afd89b0

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

mission/schema.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ properties:
4747
description: |
4848
Optional ID of the mission item, can be set to an arbitrary string
4949
type: string
50+
type:
51+
type: string
52+
not:
53+
pattern: "^internal:"
5054
allOf:
5155
- if:
5256
properties:
@@ -152,9 +156,9 @@ properties:
152156
description: |
153157
Enter Hold (aka Loiter) for a certain duration
154158
properties:
155-
delay:
159+
duration:
156160
description: |
157-
Delay in seconds. Default: 1 second
161+
Duration in seconds. Default: 1 second
158162
type: number
159163
minimum: 0
160164

px4_ros2_cpp/include/px4_ros2/mission/actions/default_actions.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ class Hold : public ActionInterface
9494
const std::shared_ptr<ActionHandler> & handler, const ActionArguments & arguments,
9595
const std::function<void()> & on_completed) override
9696
{
97-
float delay_s = 1.0f;
98-
if (arguments.contains("delay")) {
99-
delay_s = arguments.at<float>("delay");
97+
float duration_s = 1.0f;
98+
if (arguments.contains("duration")) {
99+
duration_s = arguments.at<float>("duration");
100100
}
101101
handler->runMode(ModeBase::kModeIDLoiter, [] {});
102102
_timer = _node.create_wall_timer(
103-
std::chrono::duration<float>(delay_s), [this, on_completed] {
103+
std::chrono::duration<float>(duration_s), [this, on_completed] {
104104
_timer.reset();
105105
on_completed();
106106
});

0 commit comments

Comments
 (0)