-
Notifications
You must be signed in to change notification settings - Fork 136
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
self.node.get_clock().now().to_ros_msg().unwrap()
doesn't work anymore
#385
Comments
Ok, I have a workaround for now. So you can fill the timestamp of a ros2 header correctly:
As you can see right here, your
From my point of view, this issue should definitely remain open, as timestamps are an essential resource for nodes, especially when processing sensor data. I am currently having heated discussions with someone who is using an algorithm for determining angular ranges from |
@Guelakais do you happen to have the
Can you paste a link to the ticket where you asked for this feature? Would be a nice addtion, though perhaps using the |
#381 |
@esteve it occurs to me that the vendored message packages could create a lot of confusion when building the What would you think if we put some logic into the vendoring script to check whether the Rust bindings for the messages are available in the workspace before we vendor them? We would then install the vendored bindings in a way that they can be used as if they're the upstream bindings. |
building the corresponding Ros distribution in the same workspace as ros2 rust is, in my experience, quite extraordinary. Normally, the classic ros2 developer relies on the corresponding Something basic: If in doubt, you should include your dependencies in |
@mxgrey yeah, I agree, the vendored interfaces can complicate things (this ticket is an example of that). The core issue is that we wouldn't need to this if we could get the generator included in the buildfarm. Or at least, we could do things differently.
That's a good idea, it'd make things less confusing and we'd still be able to push rclrs to crates.io |
@Guelakais the infrastruture for generating code for messages is rather complex, hence why it's not as streamlined with However, you'd still need to declare dependencies in Cargo.toml so that both |
Ok, I've been dealing with this bug all evening. For some reason rclrs keeps replacing |
Hi @Guelakais ! I am trying to construct a let stamp = rclrs::Clock::system().now().to_ros_msg().unwrap();
let header = Header {
stamp,
frame_id: "".to_string(),
}; and get : |
The functionality of my workaround can be observed in one of my nodes. Normally it works like this: let header = std_msgs::msg::Header {
frame_id: "map".to_string(),
stamp: Time {
sec: (self.node.get_clock().now().nsec /10_i64.pow(9)) as i32,
nanosec: (self.node.get_clock().now().nsec %10_i64.pow(9)) as u32,
}, I also have a rough idea of how it could be solved. For example, you can include a trait that provides the method
pub struct Time {
pub sec: i32,
pub nanosec: u32,
} 2 of these variants are autogenerated. Therefore, I am not sure whether the corresponding interface has to be incorporated directly into the autogenerator or whether it can somehow be incorporated into the time struct of rclrs. So far I had no success with the latter approach. |
On the three different variants of the message interface:
That's at least how I think about them in my own head. One of the other maintainers can correct me if I'm wrong, but I think that |
Of course you can do this if you only want to transfer already vendorised message types. At the latest when you want to transfer a ros2 |
How do you imagine how the timestamp should be filled properly and why does this error first occur today? What have you done?
The text was updated successfully, but these errors were encountered: