Skip to content

Commit 8d820f9

Browse files
committed
Add rosidl_runtime_rs::ActionImpl::create_feedback_message()
Adds a trait method to create a feedback message given the goal ID and the user-facing feedback message type. Depending on how many times we do this, it may end up valuable to define a GoalUuid type in rosidl_runtime_rs itself. We wouldn't be able to utilize the `RCL_ACTION_UUID_SIZE` constant imported from `rcl_action`, but this is pretty much guaranteed to be 16 forever. Defining this method signature also required inverting the super-trait relationship between Action and ActionImpl. Now ActionImpl is the sub-trait as this gives it access to all of Action's associated types. Action doesn't need to care about anything from ActionImpl (hopefully).
1 parent 31e38ce commit 8d820f9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

rclrs/src/action/server.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ where
8383

8484
impl<T> ActionServer<T>
8585
where
86-
T: rosidl_runtime_rs::Action,
86+
T: rosidl_runtime_rs::Action + rosidl_runtime_rs::ActionImpl,
8787
{
8888
/// Creates a new action server.
8989
pub(crate) fn new(
@@ -95,7 +95,7 @@ where
9595
accepted_callback: impl Fn(ServerGoalHandle<T>) + 'static + Send + Sync,
9696
) -> Result<Self, RclrsError>
9797
where
98-
T: rosidl_runtime_rs::Action,
98+
T: rosidl_runtime_rs::Action + rosidl_runtime_rs::ActionImpl,
9999
{
100100
// SAFETY: Getting a zero-initialized value is always safe.
101101
let mut rcl_action_server = unsafe { rcl_action_get_zero_initialized_server() };
@@ -335,7 +335,7 @@ where
335335

336336
impl<T> ActionServerBase for ActionServer<T>
337337
where
338-
T: rosidl_runtime_rs::Action,
338+
T: rosidl_runtime_rs::Action + rosidl_runtime_rs::ActionImpl,
339339
{
340340
fn handle(&self) -> &ActionServerHandle {
341341
&self.handle

rclrs/src/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ impl NodeState {
323323
handle_accepted: AcceptedCallback,
324324
) -> Result<Arc<ActionServer<ActionT>>, RclrsError>
325325
where
326-
ActionT: rosidl_runtime_rs::Action,
326+
ActionT: rosidl_runtime_rs::Action + rosidl_runtime_rs::ActionImpl,
327327
GoalCallback: Fn(GoalUuid, <ActionT as rosidl_runtime_rs::Action>::Goal) -> GoalResponse + 'static + Send + Sync,
328328
CancelCallback: Fn(ServerGoalHandle<ActionT>) -> CancelResponse + 'static + Send + Sync,
329329
AcceptedCallback: Fn(ServerGoalHandle<ActionT>) + 'static + Send + Sync,

0 commit comments

Comments
 (0)