Skip to content

Commit 3e7f376

Browse files
authored
feat: action service (ZettaScaleLabs#46)
1 parent e8d9991 commit 3e7f376

53 files changed

Lines changed: 7254 additions & 373 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ jobs:
2121
apt-get install -y \
2222
ros-jazzy-example-interfaces \
2323
ros-jazzy-rmw-zenoh-cpp \
24-
ros-jazzy-demo-nodes-cpp
24+
ros-jazzy-demo-nodes-cpp \
25+
ros-jazzy-action-tutorials-cpp
2526
2627
- uses: actions/checkout@v4
2728

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ default-members = ["ros-z", "ros-z-codegen"]
2222
ros-z = { version = "*", path = "ros-z" }
2323
rcl-z = { version = "*", path = "rcl-z" }
2424

25-
# Local roslibrust dependencies
26-
roslibrust = { git = "https://github.com/YuanYuYuan/roslibrust", branch = "feat/codegen-options" }
27-
roslibrust_codegen = { git = "https://github.com/YuanYuYuan/roslibrust", branch = "feat/codegen-options" }
25+
roslibrust = { git = "https://github.com/YuanYuYuan/roslibrust", branch = "feat/ros2-action-hash" }
26+
roslibrust_codegen = { git = "https://github.com/YuanYuYuan/roslibrust", branch = "feat/ros2-action-hash" }
2827

2928
# Serialization
3029
cdr = "0.2.4"
@@ -47,6 +46,7 @@ clap = "4.5.45"
4746
flume = "0.11.1"
4847
parking_lot = "0.12.4"
4948
tokio = "1.47.1"
49+
tokio-util = "0.7"
5050

5151
# Utilities
5252
tracing = "0.1.41"

flake.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
rcl-interfaces
6060
rclcpp
6161
rcutils
62+
demo-nodes-py
63+
demo-nodes-cpp
64+
action-tutorials-cpp
6265
];
6366

6467
messages = with pkgs.rosPackages.${rosDistro}; [
@@ -82,8 +85,6 @@
8285
devExtras = with pkgs.rosPackages.${rosDistro}; [
8386
ament-cmake-core
8487
ros-core
85-
demo-nodes-cpp
86-
demo-nodes-py
8788
rclpy
8889
rmw
8990
rmw-implementation

rcl-z/src/pubsub.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub struct SubscriptionImpl {
5454

5555
impl Waitable for SubscriptionImpl {
5656
fn is_ready(&self) -> bool {
57-
!self.inner.queue.is_empty()
57+
self.inner.queue.as_ref().map(|q| !q.is_empty()).unwrap_or(false)
5858
}
5959
}
6060

rcl-z/src/wait_set.rs

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -292,33 +292,6 @@ impl rcl_wait_set_t {
292292
self.events = std::ptr::null_mut();
293293
}
294294

295-
// fn write_ptr(&mut self, kind: &WaitSetKind, box_ptr: &Box<[*const c_void]>) {
296-
// match kind {
297-
// WaitSetKind::Subscription => {
298-
// self.subscriptions = box_ptr.as_ptr() as _;
299-
// self.size_of_subscriptions = box_ptr.len();
300-
// }
301-
// WaitSetKind::Client => {
302-
// self.clients = box_ptr.as_ptr() as _;
303-
// self.size_of_clients = box_ptr.len();
304-
// }
305-
// WaitSetKind::Service => {
306-
// self.services = box_ptr.as_ptr() as _;
307-
// self.size_of_services = box_ptr.len();
308-
//
309-
// dbg!(self.services);
310-
// unsafe {
311-
// let x = std::slice::from_raw_parts_mut(self.services, self.size_of_services);
312-
// dbg!(x);
313-
// }
314-
// }
315-
// WaitSetKind::GuradCondition => {
316-
// self.guard_conditions = box_ptr.as_ptr() as _;
317-
// self.size_of_guard_conditions = box_ptr.len();
318-
// }
319-
// }
320-
// }
321-
322295
fn write(&mut self, kind: WaitSetKind, ptr: *mut *const c_void, len: usize) {
323296
match kind {
324297
WaitSetKind::Subscription => {
@@ -422,63 +395,6 @@ impl rcl_wait_set_t {
422395
self.drop_pointer(x);
423396
});
424397
}
425-
426-
// fn assign_pointers(&mut self) {
427-
// dbg!(
428-
// self.borrow_impl()
429-
// .mirror
430-
// .clone()
431-
// .as_ref()
432-
// .unwrap()
433-
// .get(&WaitSetKind::Service)
434-
// .unwrap()
435-
// .as_ptr()
436-
// );
437-
// if let Some(mirror) = self.borrow_impl().mirror.clone() {
438-
// mirror.iter().for_each(|(kind, box_ptr)| {
439-
// tracing::error!("Assign {kind:?}: {box_ptr:?}");
440-
// self.write_ptr(kind, box_ptr);
441-
// });
442-
// }
443-
// unsafe {
444-
// let x = std::slice::from_raw_parts_mut(self.services, self.size_of_services);
445-
// dbg!("finished", x);
446-
// dbg!(
447-
// self.borrow_impl()
448-
// .mirror
449-
// .as_ref()
450-
// .unwrap()
451-
// .get(&WaitSetKind::Service)
452-
// .unwrap()
453-
// .as_ptr()
454-
// );
455-
// }
456-
// }
457-
458-
// fn debug(&self) {
459-
// WaitSetKind::iter().for_each(|kind| match kind {
460-
// WaitSetKind::Subscription => unsafe {
461-
// let x =
462-
// std::slice::from_raw_parts_mut(self.subscriptions, self.size_of_subscriptions);
463-
// dbg!(kind, x);
464-
// },
465-
// WaitSetKind::Client => unsafe {
466-
// let x = std::slice::from_raw_parts_mut(self.clients, self.size_of_clients);
467-
// dbg!(kind, x);
468-
// },
469-
// WaitSetKind::Service => unsafe {
470-
// let x = std::slice::from_raw_parts_mut(self.services, self.size_of_services);
471-
// dbg!(kind, x);
472-
// },
473-
// WaitSetKind::GuradCondition => unsafe {
474-
// let x = std::slice::from_raw_parts_mut(
475-
// self.guard_conditions,
476-
// self.size_of_guard_conditions,
477-
// );
478-
// dbg!(kind, x);
479-
// },
480-
// });
481-
// }
482398
}
483399

484400
#[unsafe(no_mangle)]

ros-z-codegen/src/protobuf_adapter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ impl ::ros_z::msg::ZMessage for {proto_type} {{
322322
match name {
323323
"MultiDOFJointState" => "MultiDofJointState".to_string(),
324324
"ColorRGBA" => "ColorRgba".to_string(),
325+
"UUID" => "Uuid".to_string(),
325326
// Add more mappings as needed
326327
_ => name.to_string(),
327328
}

0 commit comments

Comments
 (0)