-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from Carter12s/native-service-client
DRAFT: Native service client
- Loading branch information
Showing
17 changed files
with
1,172 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Purpose of this array is send and receive a large payload | ||
uint8[] bytes | ||
--- | ||
uint8[] bytes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
roslibrust_codegen_macro::find_and_generate_ros_messages!("assets/ros1_common_interfaces"); | ||
|
||
#[cfg(feature = "ros1")] | ||
#[tokio::main] | ||
async fn main() -> Result<(), anyhow::Error> { | ||
use roslibrust::ros1::NodeHandle; | ||
|
||
simple_logger::SimpleLogger::new() | ||
.with_level(log::LevelFilter::Debug) | ||
.without_timestamps() | ||
.init() | ||
.unwrap(); | ||
|
||
let nh = NodeHandle::new("http://localhost:11311", "service_client_rs").await?; | ||
log::info!("Connected!"); | ||
|
||
let response: rosapi::GetTimeResponse = nh | ||
.service_client::<rosapi::GetTime>("rosapi/get_time") | ||
.await? | ||
.call(&rosapi::GetTimeRequest {}) | ||
.await?; | ||
|
||
log::info!("Got time: {:?}", response); | ||
|
||
Ok(()) | ||
} | ||
|
||
#[cfg(not(feature = "ros1"))] | ||
fn main() { | ||
eprintln!("This example does nothing without compiling with the feature 'ros1'"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.