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

Update ros2-client to latest version #457

Merged
merged 4 commits into from
Apr 16, 2024
Merged
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
31 changes: 17 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions examples/rust-ros2-dataflow/node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ fn main() -> eyre::Result<()> {

// spawn a background spinner task that is handles service discovery (and other things)
let pool = futures::executor::ThreadPool::new()?;
let spinner = ros_node.spinner();
let spinner = ros_node
.spinner()
.map_err(|e| eyre::eyre!("failed to create spinner: {e:?}"))?;
pool.spawn(async {
if let Err(err) = spinner.spin().await {
eprintln!("ros2 spinner failed: {err:?}");
Expand Down Expand Up @@ -150,7 +152,7 @@ async fn add_two_ints_request(

let response = add_client.async_receive_response(request_id);
futures::pin_mut!(response);
let timeout = futures_timer::Delay::new(Duration::from_secs(5));
let timeout = futures_timer::Delay::new(Duration::from_secs(15));
match futures::future::select(response, timeout).await {
futures::future::Either::Left((Ok(response), _)) => {
println!("received response: {response:?}");
Expand All @@ -172,7 +174,7 @@ fn init_ros_node() -> eyre::Result<ros2_client::Node> {
.map_err(|e| eyre!("failed to create ROS2 node name: {e}"))?,
NodeOptions::new().enable_rosout(true),
)
.context("failed to create ros2 node")
.map_err(|e| eyre::eyre!("failed to create ros2 node: {e:?}"))
}

fn create_vel_publisher(
Expand Down
4 changes: 2 additions & 2 deletions libraries/extensions/ros2-bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ array-init = "2.1.0"
serde = { version = "1.0.164", features = ["derive"] }
serde-big-array = "0.5.1"
widestring = "1.0.2"
ros2-client = { git = "https://github.com/dora-rs/ros2-client.git", branch = "deserialize-seed-2" }
rustdds = { git = "https://github.com/dora-rs/RustDDS.git", branch = "deserialize-seed-2" }
ros2-client = "0.7.1"
rustdds = "0.10.0"
eyre = { version = "0.6.8", optional = true }
tokio = { version = "1.29.1", features = ["full"], optional = true }
dora-daemon = { path = "../../../binaries/daemon", optional = true }
Expand Down
5 changes: 3 additions & 2 deletions libraries/extensions/ros2-bridge/msg-gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ where

let name = ros2_client::NodeName::new(name_space, base_name).map_err(|e| eyre::eyre!(e))?;
let options = ros2_client::NodeOptions::new().enable_rosout(true);
let mut node = self.context.new_node(name, options)?;
let mut node = self.context.new_node(name, options)
.map_err(|e| eyre::eyre!("failed to create ROS2 node: {e:?}"))?;

let spinner = node.spinner();
let spinner = node.spinner().context("failed to create spinner")?;
self.executor.spawn(async {
if let Err(err) = spinner.spin().await {
eprintln!("ros2 spinner failed: {err:?}");
Expand Down
5 changes: 4 additions & 1 deletion libraries/extensions/ros2-bridge/python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ impl Ros2Context {
let name = ros2_client::NodeName::new(namespace, name)
.map_err(|err| eyre!("invalid node name: {err}"))?;
Ok(Ros2Node {
node: self.context.new_node(name, options.into())?,
node: self
.context
.new_node(name, options.into())
.map_err(|e| eyre::eyre!("failed to create ROS2 node: {e:?}"))?,
messages: self.messages.clone(),
})
}
Expand Down
Loading