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

use local rosrust #8

Closed
lucasw opened this issue Nov 22, 2020 · 2 comments
Closed

use local rosrust #8

lucasw opened this issue Nov 22, 2020 · 2 comments

Comments

@lucasw
Copy link
Owner

lucasw commented Nov 22, 2020

Need to have dependencies like this

[dependencies]
# rosrust = "0.9.5"
# rosrust_msg = "0.1.1"
rosrust = { path = "../../../../rosrust/rosrust" }
rosrust_msg = { path = "../../../../rosrust/rosrust_msg" }

It's not possible to point at just the top level rosrust directory, the individual packages need to be called out (or for that to work it has to be called out differently, how to distinguish between rosrust at the top level and the Cargo.toml one level down also called rosrust?).

Also, rosrust_msg depends on rosrust, but it doesn't take the one specified above, this results in an error

error[E0277]: the trait bound `rosrust_msg::rosgraph_msgs::Log: rosrust::Message` is not satisfied
  --> src/loginfo/main.rs:8:5
   |
8  |     rosout_pub: ros::Publisher<Log>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `rosrust::Message` is not implemented for `rosrust_msg::rosgraph_msgs::Log`
   | 
  ::: /home/lucasw/own/src/rust/rosrust/rosrust/src/api/raii.rs:14:25
   |
14 | pub struct Publisher<T: Message> {
   |                         ------- required by this bound in `rosrust::Publisher`

error[E0277]: the trait bound `rosrust_msg::std_msgs::Float32: rosrust::Message` is not satisfied
  --> src/loginfo/main.rs:9:5
   |
9  |     float_pub: ros::Publisher<Float32>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `rosrust::Message` is not implemented for `rosrust_msg::std_msgs::Float32`
   | 
  ::: /home/lucasw/own/src/rust/rosrust/rosrust/src/api/raii.rs:14:25
   |
14 | pub struct Publisher<T: Message> {
   |                         ------- required by this bound in `rosrust::Publisher`

error: aborting due to 2 previous errors

So have to fix the rosrust_msg dependency to depend on the local rosrust:

[dependencies]
# rosrust = "0.9.5"
rosrust = { path = "../rosrust" }

PR for above here adnanademovic/rosrust#153

@lucasw lucasw closed this as completed Nov 22, 2020
@lucasw
Copy link
Owner Author

lucasw commented Nov 23, 2020

But accidentally checked in the relative path toml, which broke the github action later- how to use the local rosrust locally, but not touch the Cargo.toml that gets checked in? Probably can create a unchecked in Cargo.toml that points to the right places but is not the same as the git version, not even in the source tree.

rust-lang/cargo#6583

@lucasw
Copy link
Owner Author

lucasw commented Nov 23, 2020

Instead of a local rosrust, can use a branch specified with a git path

rosrust = { git = "https://github.com/lucasw/rosrust", branch = "noetic_aggregated" }
rosrust_msg = { git = "https://github.com/lucasw/rosrust", branch = "noetic_aggregated" }

Both rosrust and rosrust_msg are needed on separate lines, there isn't a way to tell Cargo to only use a path within the git repo.
rust-lang/cargo#1462

So always have to push changes up to test, but that isn't a huge deal, that branch is flexible and any amount of junk commits and rebases are fine there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant