-
Notifications
You must be signed in to change notification settings - Fork 152
self.node.get_clock().now().to_ros_msg().unwrap()
doesn't work anymore
#385
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
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 |
I have faced the same issue. This workaround works but it is not trivial for newcomers. |
not the way ros2 rust is implemented. The problem is that ros2 rust has implemented a completely separate ros2 message stack for testing purposes, which collides with the normal ros2 message stack. In my opinion there are only 2 options:
You could also address the messages in ros2 rust directly and work with them. Then you don't have the problem. At the same time, ros2 will then only be usable to a very limited extent. |
Hi @Guelakais |
In the working group meeting today it was mentioned that we might not need the vendored messages if the build farm would generate the bindings for the message packages that However, IIUC crates.io wouldn't allow us to have dependencies on any crates that are not also published to crates.io. So for Does all of that match your understanding @esteve ? The only way I can think of working around this such that we can keep There would likely be a lot of data structures introduced to |
Yes. Once we have the generator as part of the buildfarm, we could explore publishing some of the base message packages as crates, I think it might work, but we'd have to test it. In any case, yeah, I agree the situation is not ideal, especially now that we're in a transition period before submitting the message generator to the buildfarm. I'd prefer if we can keep |
I'm not particularly against this, but I can imagine us running into conflicts with crate names as generic as I guess we just need to hope that there aren't others in the crates.io ecosystem that would want to fight us for ownership of those crate names.
I fully agree with that. I'm trying to brainstorm how to play as nicely as possible with both ecosystems at the same time. Unsurprisingly it's just very tricky to stand with each foot in a different world at once. |
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: