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

Time to time msg bug #392

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Empty file modified .dockerignore
100644 → 100755
Empty file.
Empty file modified .github/workflows/rust.yml
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .rustfmt.toml
100644 → 100755
Empty file.
Empty file modified Dockerfile
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified NOTICE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified docs/CONTRIBUTING.md
100644 → 100755
Empty file.
Empty file modified docs/building.md
100644 → 100755
Empty file.
Empty file modified docs/writing-your-first-rclrs-node.md
100644 → 100755
Empty file.
Empty file modified examples/message_demo/Cargo.toml
100644 → 100755
Empty file.
Empty file modified examples/message_demo/package.xml
100644 → 100755
Empty file.
Empty file modified examples/message_demo/src/message_demo.rs
100644 → 100755
Empty file.
Empty file modified examples/minimal_client_service/Cargo.toml
100644 → 100755
Empty file.
Empty file modified examples/minimal_client_service/package.xml
100644 → 100755
Empty file.
Empty file modified examples/minimal_client_service/src/minimal_client.rs
100644 → 100755
Empty file.
Empty file modified examples/minimal_client_service/src/minimal_client_async.rs
100644 → 100755
Empty file.
Empty file modified examples/minimal_client_service/src/minimal_service.rs
100644 → 100755
Empty file.
Empty file modified examples/minimal_pub_sub/Cargo.toml
100644 → 100755
Empty file.
Empty file modified examples/minimal_pub_sub/launch/minimal_pub_sub.launch.xml
100644 → 100755
Empty file.
Empty file modified examples/minimal_pub_sub/package.xml
100644 → 100755
Empty file.
Empty file modified examples/minimal_pub_sub/src/minimal_publisher.rs
100644 → 100755
Empty file.
Empty file modified examples/minimal_pub_sub/src/minimal_subscriber.rs
100644 → 100755
Empty file.
Empty file modified examples/minimal_pub_sub/src/minimal_two_nodes.rs
100644 → 100755
Empty file.
Empty file modified examples/minimal_pub_sub/src/zero_copy_publisher.rs
100644 → 100755
Empty file.
Empty file modified examples/minimal_pub_sub/src/zero_copy_subscriber.rs
100644 → 100755
Empty file.
Empty file modified examples/rclrs_example_msgs/CMakeLists.txt
100644 → 100755
Empty file.
Empty file modified examples/rclrs_example_msgs/msg/MyMessage.idl
100644 → 100755
Empty file.
Empty file modified examples/rclrs_example_msgs/msg/NestedType.msg
100644 → 100755
Empty file.
Empty file modified examples/rclrs_example_msgs/msg/VariousTypes.msg
100644 → 100755
Empty file.
Empty file modified examples/rclrs_example_msgs/package.xml
100644 → 100755
Empty file.
Empty file modified rclrs/CHANGELOG.rst
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion rclrs/Cargo.toml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ cfg-if = "1.0.0"

# Needed for clients
futures = "0.3"
builtin_interfaces="*"

# Needed for dynamic messages
libloading = { version = "0.8", optional = true }
Expand All @@ -34,7 +35,7 @@ rosidl_runtime_rs = "0.4"
tempfile = "3.3.0"
# Needed for publisher and subscriber tests
test_msgs = {version = "*"}

builtin_interfaces="*"
[build-dependencies]
# Needed for FFI
bindgen = "0.66.1"
Expand Down
Empty file modified rclrs/README.md
100644 → 100755
Empty file.
Empty file modified rclrs/build.rs
100644 → 100755
Empty file.
Empty file modified rclrs/package.xml
100644 → 100755
Empty file.
Empty file modified rclrs/src/arguments.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/client.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/clock.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/context.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/dynamic_message.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/dynamic_message/error.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/error.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/executor.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/lib.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/node.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/node/builder.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/node/graph.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/parameter.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/parameter/override_map.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/parameter/service.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/parameter/value.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/publisher.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/publisher/loaned_message.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/qos.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/rcl_bindings.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/rcl_wrapper.h
100644 → 100755
Empty file.
Empty file modified rclrs/src/service.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/subscription.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/subscription/callback.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/subscription/message_info.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/subscription/readonly_loaned_message.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/test_helpers/graph_helpers.rs
100644 → 100755
Empty file.
Empty file modified rclrs/src/test_helpers/mod.rs
100644 → 100755
Empty file.
18 changes: 7 additions & 11 deletions rclrs/src/time.rs
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::{rcl_bindings::*, vendor::builtin_interfaces};
use crate::rcl_bindings::*;
use builtin_interfaces::msg::Time as timeMsg;
use std::{
num::TryFromIntError,
ops::{Add, Sub},
sync::{Mutex, Weak},
time::Duration,
};

/// Struct that represents time.
#[derive(Clone, Debug)]
pub struct Time {
Expand All @@ -26,15 +26,11 @@ impl Time {
.ptr_eq(&rhs.clock)
.then(|| f(self.nsec, rhs.nsec))
}

/// Convenience function for converting time to ROS message
pub fn to_ros_msg(&self) -> Result<builtin_interfaces::msg::Time, TryFromIntError> {
let nanosec = self.nsec % 1_000_000_000;
let sec = self.nsec / 1_000_000_000;

Ok(builtin_interfaces::msg::Time {
nanosec: nanosec.try_into()?,
sec: sec.try_into()?,
/// Convenient method to create builtin_interfaces::msg::Time objects from rclrs::Time
pub fn to_ros_msg(&self) -> Result<timeMsg, TryFromIntError> {
Ok(timeMsg {
nanosec: (self.nsec % 10_i64.pow(9)) as u32,
sec: (self.nsec / 10_i64.pow(9)) as i32,
})
}
}
Expand Down
Empty file modified rclrs/src/time_source.rs
100644 → 100755
Empty file.
3 changes: 0 additions & 3 deletions rclrs/src/vendor/builtin_interfaces/mod.rs

This file was deleted.

258 changes: 0 additions & 258 deletions rclrs/src/vendor/builtin_interfaces/msg.rs

This file was deleted.

1 change: 0 additions & 1 deletion rclrs/src/vendor/mod.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
#![allow(dead_code)]
#![allow(clippy::derive_partial_eq_without_eq)]

pub mod builtin_interfaces;
pub mod rcl_interfaces;
pub mod rosgraph_msgs;
Empty file modified rclrs/src/vendor/rcl_interfaces/mod.rs
100644 → 100755
Empty file.
Loading
Loading