Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Action support #410

Draft
wants to merge 61 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
f6ced1e
Added skeleton examples for action client and server
esteve Nov 28, 2022
f279041
Added action template
esteve Nov 28, 2022
483164a
Added action generation
esteve Nov 28, 2022
f555bbf
Added basic create_action_client function
esteve Nov 28, 2022
a89c196
Fix linter
esteve Nov 29, 2022
203b252
Split action client and server examples
esteve Jul 17, 2023
0b0bf4d
checkin
esteve Jul 17, 2023
1cc545e
checkin
esteve Jul 17, 2023
9fe3169
checkin
esteve Aug 10, 2023
e685f83
fix visibility
esteve Aug 10, 2023
1b5dd0c
Instantiate a new ActionClient
esteve Nov 8, 2023
eaa47f1
dded action generation
esteve Nov 28, 2022
3740a27
checkin
esteve Jul 17, 2023
3e4e718
checkin
esteve Jul 17, 2023
747f05d
checkin
esteve Nov 17, 2023
e1c837c
checkin
esteve Nov 17, 2023
af46ec4
checkin
esteve Nov 17, 2023
3e6fd1b
Fix missing exported pre_field_serde field
esteve Jan 17, 2024
55edf88
Removed extra code
esteve Jan 17, 2024
dccc667
Fix rclrs to compile after rebase
nwn Jun 6, 2024
573754d
Sketch out action server construction and destruction
nwn Jun 6, 2024
3733e5e
Sketch out action client as well
nwn Jun 6, 2024
ac4cc64
Pass rcl_clock_t from Node to ActionServer
nwn Jun 6, 2024
018ef66
Split action servers and clients into separate modules
nwn Jun 6, 2024
279bd8a
Move ServerGoalHandle to separate module
nwn Jun 6, 2024
8b76a0e
Begin implementing ActionServerGoalHandle functions
nwn Jun 6, 2024
a45b8ba
Make GoalUuid into a newtype
nwn Jun 8, 2024
03b9b74
Document the ServerGoalHandle struct
nwn Jun 8, 2024
045a66d
Add documentation and clean up
nwn Jun 8, 2024
38c5b95
Fix action typesupport function
nwn Jun 11, 2024
a323bd0
Take goal, cancel, and accepted callbacks in ActionServer
nwn Jun 11, 2024
0319419
Store action clients and servers in the Node
nwn Jul 6, 2024
b6c8b47
Add action client/server entities to wait set
nwn Jul 7, 2024
2fbd496
Handle action server/client readiness in WaitSet and executor
nwn Jul 7, 2024
d5fc2f3
Add rcl_action error codes
nwn Jul 13, 2024
e72d1c9
Add ActionImpl trait with internal messages and services
nwn Jul 13, 2024
02dcc7a
[WIP] Start defining server/client execute functions
nwn Jul 13, 2024
edebb76
Split srv.rs.em into idiomatic and rmw template files
nwn Jul 20, 2024
c9a28f7
Generate underlying service definitions for actions
nwn Jul 20, 2024
dc8781c
Add runtime trait to get the UUID from a goal request
nwn Jul 20, 2024
9d6a8b8
Use rcl-allocated goal handle pointer in ServerGoalHandle
nwn Jul 20, 2024
5425072
Split execute_goal_request() out into three functions
nwn Jul 20, 2024
9595b6e
Partial implementation of ActionServer::publish_status()
nwn Jul 25, 2024
5496b10
Add DropGuard convenience wrapper
nwn Aug 7, 2024
46e7093
Complete implementation of ActionServer::publish_status()
nwn Aug 7, 2024
b15c0c5
Move goal acceptance logic back into execute_goal_request()
nwn Aug 7, 2024
f8fedbc
Integrate RMW message methods into ActionImpl
nwn Aug 7, 2024
241f642
Add UUID->GoalHandle hash-map to action server
nwn Aug 7, 2024
1e75ce8
Add rosidl_runtime_rs::ActionImpl::create_feedback_message()
nwn Aug 9, 2024
ea04dcb
Add ActionServer::publish_feedback() method
nwn Aug 9, 2024
b06c14c
Implement goal expiration in action server
nwn Aug 9, 2024
249d5ec
Implement goal cancel requests
nwn Aug 10, 2024
213f891
Add GetResultService methods to ActionImpl
nwn Aug 16, 2024
a7c45fc
Implement action result requests in the action server
nwn Aug 16, 2024
a33ec48
Implement ActionImpl trait methods in generator
nwn Aug 16, 2024
e98882f
Fix formatting in example
nwn Aug 23, 2024
4ff9fd4
Hook up ServerGoalHandle callbacks into the ActionServer
nwn Aug 23, 2024
d8a0a1d
Replace set_result_response_status with create_result_response
nwn Aug 23, 2024
4d597c8
Switch to create_result_response() in rclrs
nwn Aug 23, 2024
be5b7e1
Hook up goal termination methods for goal handles
nwn Aug 23, 2024
75fd275
Implement client-side trait methods for action messages
nwn Sep 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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).
  • Loading branch information
nwn committed Sep 28, 2024
commit 1e75ce8adf72bcafad78f8d8a93a4cb2d2fa499f
6 changes: 3 additions & 3 deletions rclrs/src/action/server.rs
Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ where

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

impl<T> ActionServerBase for ActionServer<T>
where
T: rosidl_runtime_rs::Action,
T: rosidl_runtime_rs::Action + rosidl_runtime_rs::ActionImpl,
{
fn handle(&self) -> &ActionServerHandle {
&self.handle
2 changes: 1 addition & 1 deletion rclrs/src/node.rs
Original file line number Diff line number Diff line change
@@ -244,7 +244,7 @@ impl Node {
handle_accepted: AcceptedCallback,
) -> Result<Arc<ActionServer<ActionT>>, RclrsError>
where
ActionT: rosidl_runtime_rs::Action,
ActionT: rosidl_runtime_rs::Action + rosidl_runtime_rs::ActionImpl,
GoalCallback: Fn(GoalUuid, <ActionT as rosidl_runtime_rs::Action>::Goal) -> GoalResponse + 'static + Send + Sync,
CancelCallback: Fn(ServerGoalHandle<ActionT>) -> CancelResponse + 'static + Send + Sync,
AcceptedCallback: Fn(ServerGoalHandle<ActionT>) + 'static + Send + Sync,
7 changes: 5 additions & 2 deletions rosidl_runtime_rs/src/traits.rs
Original file line number Diff line number Diff line change
@@ -163,7 +163,7 @@ pub trait Service: 'static {
/// Trait for actions.
///
/// User code never needs to call this trait's method, much less implement this trait.
pub trait Action: 'static + ActionImpl {
pub trait Action: 'static {
/// The goal message associated with this action.
type Goal: Message;

@@ -180,7 +180,7 @@ pub trait Action: 'static + ActionImpl {
/// Trait for action implementation details.
///
/// User code never needs to implement this trait, nor use its associated types.
pub trait ActionImpl: 'static {
pub trait ActionImpl: 'static + Action {
/// The goal_status message associated with this action.
type GoalStatusMessage: Message;

@@ -201,4 +201,7 @@ pub trait ActionImpl: 'static {

/// Sets the `accepted` field of a goal response.
fn set_goal_response_accepted(response: &mut <<Self::SendGoalService as Service>::Response as Message>::RmwMsg, accepted: bool);

/// Create a feedback message with the given goal ID and contents.
fn create_feedback_message(goal_id: &[u8; 16], feedback: &<<Self as Action>::Feedback as Message>::RmwMsg) -> <Self::FeedbackMessage as Message>::RmwMsg;
}