Crates.io | moto-hses-client |
lib.rs | moto-hses-client |
version | 0.0.2 |
created_at | 2025-09-21 23:15:58.889729+00 |
updated_at | 2025-09-21 23:54:19.68331+00 |
description | Async UDP client for Yaskawa High-Speed Ethernet Server (HSES) communication |
homepage | https://github.com/masayuki-kono/moto-hses |
repository | https://github.com/masayuki-kono/moto-hses |
max_upload_size | |
id | 1849299 |
size | 209,528 |
Async UDP client for Yaskawa High-Speed Ethernet Server (HSES) communication.
This crate provides a high-level, type-safe, asynchronous Rust client for communicating with Yaskawa robots using the HSES (High Speed Ethernet Server) protocol over UDP. It's built on top of Tokio and provides a modern async/await API.
Add this to your Cargo.toml
:
[dependencies]
moto-hses-client = "0.0.2"
tokio = { version = "1.0", features = ["full"] }
use moto_hses_client::HsesClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create client
let client = HsesClient::new("192.168.1.100:10040").await?;
// Read alarm data
let alarm = client.read_alarm_data(1, 0).await?;
println!("Alarm Code: {}", alarm.code);
println!("Alarm Name: {}", alarm.name);
// Reset alarm
client.reset_alarm().await?;
println!("Alarm reset completed");
Ok(())
}
The crate includes comprehensive examples in the examples/
directory:
basic_usage.rs
- Basic client operationsalarm_operations.rs
- Alarm data handlingio_operations.rs
- I/O operationsposition_operations.rs
- Position data operationsvariable_operations.rs
- Variable read/write operationsconnection_management.rs
- Connection handlingfile_operations.rs
- File transfer operationshold_servo_control.rs
- Servo control operationsregister_operations.rs
- Register operationsread_executing_job_info.rs
- Job informationread_status.rs
- Status monitoring# Run a specific example
RUST_LOG=info cargo run --example alarm_operations -- 192.168.1.100 10040
The crate can be tested using the separate moto-hses-mock
crate:
[dev-dependencies]
moto-hses-mock = "0.0.2"
use moto_hses_client::HsesClient;
use moto_hses_mock::{MockServer, MockServerBuilder};
use moto_hses_proto::Alarm;
#[tokio::test]
async fn test_alarm_operations() {
// Start mock server with test alarm
let server = MockServerBuilder::new()
.host("127.0.0.1")
.robot_port(10040)
.file_port(10041)
.with_alarm(Alarm::new(1001, 0, 0, "2024-01-01 12:00:00".to_string(), "Test alarm".to_string()))
.build()
.await
.unwrap();
// Start the server in the background
let server_handle = tokio::spawn(async move {
server.run().await.unwrap();
});
let client = HsesClient::new("127.0.0.1:10040").await.unwrap();
// Test alarm operations
let alarm = client.read_alarm_data(1, 0).await.unwrap();
assert_eq!(alarm.code, 1001);
assert_eq!(alarm.name, "Test alarm");
// Test alarm reset
client.reset_alarm().await.unwrap();
// Clean up
server_handle.abort();
}
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.
moto-hses-proto
- Protocol definitions and serializationmoto-hses-mock
- Mock HSES server for testing