Skip to content

Commit 38a471c

Browse files
committed
Fix compilation after rebase
Just the bare minimum to get things working after the rebase. Lots of clean-up still to do.
1 parent 53ebbbe commit 38a471c

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

examples/minimal_action_server/src/minimal_action_server.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
use anyhow::{Error, Result};
22
use rclrs::*;
3-
use std::{env, sync::Arc, thread};
3+
use std::{sync::Arc, thread};
44

55
type Fibonacci = example_interfaces::action::Fibonacci;
66
type GoalHandleFibonacci = rclrs::ServerGoalHandle<Fibonacci>;
77

88
fn handle_goal(
9-
_uuid: &rclrs::GoalUUID,
10-
goal: Arc<example_interfaces::action::rmw::Fibonacci_Goal>,
9+
_uuid: rclrs::GoalUuid,
10+
goal: example_interfaces::action::Fibonacci_Goal,
1111
) -> rclrs::GoalResponse {
1212
println!("Received goal request with order {}", goal.order);
1313
if goal.order > 9000 {
@@ -24,11 +24,11 @@ fn handle_cancel(_goal_handle: Arc<GoalHandleFibonacci>) -> rclrs::CancelRespons
2424

2525
fn execute(goal_handle: Arc<GoalHandleFibonacci>) {
2626
println!("Executing goal");
27-
let feedback = example_interfaces::action::Fibonacci_Feedback {
27+
let mut feedback = example_interfaces::action::Fibonacci_Feedback {
2828
sequence: [0, 1].to_vec(),
2929
};
3030

31-
for i in 1..goal_handle.goal_request.order {
31+
for i in 1..goal_handle.goal().order {
3232
if goal_handle.is_canceling() {
3333
let result = example_interfaces::action::Fibonacci_Result {
3434
sequence: Vec::new(),
@@ -50,9 +50,8 @@ fn execute(goal_handle: Arc<GoalHandleFibonacci>) {
5050
}
5151

5252
let result = example_interfaces::action::Fibonacci_Result {
53-
sequence: Vec::new(),
53+
sequence: feedback.sequence,
5454
};
55-
result.sequence = feedback.sequence.clone();
5655
goal_handle.succeed(&result);
5756
println!("Goal succeeded");
5857
}
@@ -68,7 +67,7 @@ fn main() -> Result<(), Error> {
6867

6968
let node = executor.create_node("minimal_action_server")?;
7069

71-
let _action_server = node.create_action_server::<example_interfaces::action::Fibonacci>(
70+
let _action_server = node.create_action_server::<example_interfaces::action::Fibonacci, _, _, _>(
7271
"fibonacci",
7372
handle_goal,
7473
handle_cancel,

rclrs/src/action/server.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ pub(crate) enum ReadyMode {
6666
}
6767

6868
pub type GoalCallback<ActionT> = dyn Fn(GoalUuid, <ActionT as rosidl_runtime_rs::Action>::Goal) -> GoalResponse + 'static + Send + Sync;
69-
pub type CancelCallback<ActionT> = dyn Fn(ServerGoalHandle<ActionT>) -> CancelResponse + 'static + Send + Sync;
70-
pub type AcceptedCallback<ActionT> = dyn Fn(ServerGoalHandle<ActionT>) + 'static + Send + Sync;
69+
pub type CancelCallback<ActionT> = dyn Fn(Arc<ServerGoalHandle<ActionT>>) -> CancelResponse + 'static + Send + Sync;
70+
pub type AcceptedCallback<ActionT> = dyn Fn(Arc<ServerGoalHandle<ActionT>>) + 'static + Send + Sync;
7171

7272
pub struct ActionServer<ActionT>
7373
where
@@ -95,8 +95,8 @@ where
9595
clock: Clock,
9696
topic: &str,
9797
goal_callback: impl Fn(GoalUuid, T::Goal) -> GoalResponse + 'static + Send + Sync,
98-
cancel_callback: impl Fn(ServerGoalHandle<T>) -> CancelResponse + 'static + Send + Sync,
99-
accepted_callback: impl Fn(ServerGoalHandle<T>) + 'static + Send + Sync,
98+
cancel_callback: impl Fn(Arc<ServerGoalHandle<T>>) -> CancelResponse + 'static + Send + Sync,
99+
accepted_callback: impl Fn(Arc<ServerGoalHandle<T>>) + 'static + Send + Sync,
100100
) -> Result<Self, RclrsError>
101101
where
102102
T: rosidl_runtime_rs::Action + rosidl_runtime_rs::ActionImpl,

rclrs/src/action/server_goal_handle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ where
208208
/// This may only be called when the goal is executing.
209209
///
210210
/// Returns an error if the goal is in any state other than executing.
211-
pub fn publish_feedback(&self, feedback: Arc<ActionT::Feedback>) -> Result<(), RclrsError> {
211+
pub fn publish_feedback(&self, feedback: &ActionT::Feedback) -> Result<(), RclrsError> {
212212
// If the action server no longer exists, simply drop the message.
213213
if let Some(action_server) = self.action_server.upgrade() {
214-
action_server.publish_feedback(&self.uuid, &*feedback)?;
214+
action_server.publish_feedback(&self.uuid, feedback)?;
215215
}
216216
Ok(())
217217
}

rclrs/src/node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ impl NodeState {
325325
where
326326
ActionT: rosidl_runtime_rs::Action + rosidl_runtime_rs::ActionImpl,
327327
GoalCallback: Fn(GoalUuid, <ActionT as rosidl_runtime_rs::Action>::Goal) -> GoalResponse + 'static + Send + Sync,
328-
CancelCallback: Fn(ServerGoalHandle<ActionT>) -> CancelResponse + 'static + Send + Sync,
329-
AcceptedCallback: Fn(ServerGoalHandle<ActionT>) + 'static + Send + Sync,
328+
CancelCallback: Fn(Arc<ServerGoalHandle<ActionT>>) -> CancelResponse + 'static + Send + Sync,
329+
AcceptedCallback: Fn(Arc<ServerGoalHandle<ActionT>>) + 'static + Send + Sync,
330330
{
331331
let action_server = Arc::new(ActionServer::<ActionT>::new(
332332
self,

0 commit comments

Comments
 (0)