moto-hses-proto

Crates.iomoto-hses-proto
lib.rsmoto-hses-proto
version0.0.2
created_at2025-09-21 21:37:31.033312+00
updated_at2025-09-21 23:53:41.358543+00
descriptionProtocol definitions and serialization for Yaskawa High-Speed Ethernet Server (HSES)
homepagehttps://github.com/masayuki-kono/moto-hses
repositoryhttps://github.com/masayuki-kono/moto-hses
max_upload_size
id1849224
size135,942
masayuki-kono (masayuki-kono)

documentation

https://docs.rs/moto-hses-proto

README

moto-hses-proto

Crates.io Documentation License Gate of Main Security Audit

Protocol definitions and serialization for Yaskawa High-Speed Ethernet Server (HSES).

Overview

This crate provides the core protocol definitions and serialization/deserialization functionality for communicating with Yaskawa robots using the HSES (High Speed Ethernet Server) protocol over UDP.

Features

  • Type-safe protocol definitions: Rust structs and enums for all HSES message types
  • Efficient serialization: Zero-copy deserialization where possible
  • Comprehensive error handling: Detailed error types for protocol violations
  • Japanese language support: Proper handling of Japanese text (Shift-JIS) in robot data

Installation

Add this to your Cargo.toml:

[dependencies]
moto-hses-proto = "0.0.2"

Usage

use moto_hses_proto::{HsesRequestMessage, HsesResponseMessage, Service, Division, ReadAlarmData, Alarm};

// Create a read alarm command
let read_alarm = ReadAlarmData::new();

// Create HSES request message
let request = HsesRequestMessage::new(
    Service::Control,
    read_alarm,
    Division::Robot,
    vec![], // No additional data needed for read commands
);

// Serialize to bytes
let request_bytes: Vec<u8> = request.try_into()?;

// Deserialize from bytes
let parsed_request = HsesRequestMessage::try_from(request_bytes.as_slice())?;

// Example: Create an alarm for testing
let alarm = Alarm::new(
    1001,  // alarm code
    0,     // data
    0,     // alarm type
    "2024-01-01 12:00:00".to_string(), // time
    "Test alarm".to_string()           // name
);

Protocol Support

This crate implements the HSES protocol as specified in the official Yaskawa documentation:

  • Variable operations: Read/write integer, real, string, and position variables
  • I/O operations: Digital and analog I/O control
  • File operations: File transfer and management
  • Status monitoring: Robot status and alarm information
  • Position control: Cartesian and joint position data

Error Handling

The crate provides comprehensive error handling through the HsesError type:

use moto_hses_proto::HsesError;

match result {
    Ok(data) => println!("Success: {:?}", data),
    Err(HsesError::InvalidMessage) => println!("Invalid message format"),
    Err(HsesError::UnsupportedCommand) => println!("Command not supported"),
    Err(e) => println!("Other error: {}", e),
}

License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.

Related Crates

References

Commit count: 188

cargo fmt