2026-07-30 15:09:07 +08:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
|
|
package cmvr.api;
|
|
|
|
|
|
|
|
|
|
import "cmvr/api/common.proto";
|
|
|
|
|
import "cmvr/msgs/motor.proto";
|
|
|
|
|
|
|
|
|
|
// Selects exactly one motor inside the MotorManager named by header.device_id.
|
|
|
|
|
message MotorTarget {
|
|
|
|
|
CommandHeader.Request header = 1;
|
|
|
|
|
oneof selector {
|
|
|
|
|
uint32 motor_id = 2;
|
|
|
|
|
string joint_name = 3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message MotorWaitOptions {
|
|
|
|
|
// Zero selects the server default (30 seconds).
|
|
|
|
|
uint32 timeout_ms = 1;
|
|
|
|
|
// Zero selects the server default (10 milliseconds).
|
|
|
|
|
uint32 poll_period_ms = 2;
|
|
|
|
|
// Zero selects the server default.
|
|
|
|
|
double position_tolerance_rad = 3;
|
|
|
|
|
double velocity_tolerance_rad_s = 4;
|
|
|
|
|
// Number of consecutive in-tolerance samples. Zero selects the default (3).
|
|
|
|
|
uint32 settle_sample_count = 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum MotorControlType {
|
|
|
|
|
MOTOR_CONTROL_NONE = 0;
|
|
|
|
|
MOTOR_CONTROL_SET_ZERO = 1;
|
|
|
|
|
MOTOR_CONTROL_PROFILE_POSITION = 2;
|
|
|
|
|
MOTOR_CONTROL_PROFILE_VELOCITY = 3;
|
|
|
|
|
MOTOR_CONTROL_CYCLIC_POSITION = 4;
|
|
|
|
|
MOTOR_CONTROL_CYCLIC_VELOCITY = 5;
|
|
|
|
|
MOTOR_CONTROL_SET_ENABLED = 6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message MotorStatus {
|
|
|
|
|
uint32 motor_id = 1;
|
|
|
|
|
string joint_name = 2;
|
|
|
|
|
cmvr.msgs.RunMode run_mode = 3;
|
|
|
|
|
double position_rad = 4;
|
|
|
|
|
double velocity_rad_s = 5;
|
|
|
|
|
bool target_reached = 6;
|
|
|
|
|
bool service_busy = 7;
|
|
|
|
|
MotorControlType active_control = 8;
|
|
|
|
|
bool emergency_stopped = 9;
|
|
|
|
|
string last_error = 10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message MotorCommandResponse {
|
|
|
|
|
CommandHeader.Feedback header = 1;
|
|
|
|
|
MotorStatus status = 2;
|
|
|
|
|
uint64 elapsed_ms = 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message SetMotorZeroRequest {
|
|
|
|
|
MotorTarget target = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message MoveMotorToZeroRequest {
|
|
|
|
|
MotorTarget target = 1;
|
|
|
|
|
double max_velocity_rad_s = 2;
|
|
|
|
|
double acceleration_rad_s2 = 3;
|
|
|
|
|
MotorWaitOptions wait = 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message ProfilePositionRequest {
|
|
|
|
|
MotorTarget target = 1;
|
|
|
|
|
double target_position_rad = 2;
|
|
|
|
|
double max_velocity_rad_s = 3;
|
|
|
|
|
double acceleration_rad_s2 = 4;
|
|
|
|
|
MotorWaitOptions wait = 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message ProfileVelocityRequest {
|
|
|
|
|
MotorTarget target = 1;
|
|
|
|
|
double target_velocity_rad_s = 2;
|
|
|
|
|
double acceleration_rad_s2 = 3;
|
|
|
|
|
MotorWaitOptions wait = 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message EmergencyStopRequest {
|
|
|
|
|
MotorTarget target = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message GetMotorStatusRequest {
|
|
|
|
|
MotorTarget target = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message GetMotorStatusResponse {
|
|
|
|
|
CommandHeader.Feedback header = 1;
|
|
|
|
|
MotorStatus status = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message SetMotorEnabledRequest {
|
|
|
|
|
MotorTarget target = 1;
|
|
|
|
|
bool enabled = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message CyclicStreamOpen {
|
|
|
|
|
MotorTarget target = 1;
|
2026-08-04 10:36:23 +08:00
|
|
|
// The device/driver watchdog is authoritative. This service watchdog prevents a
|
2026-07-30 15:09:07 +08:00
|
|
|
// stalled gRPC client from retaining control indefinitely.
|
|
|
|
|
uint32 watchdog_timeout_ms = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message CyclicPositionSetpoint {
|
|
|
|
|
uint64 sequence = 1;
|
|
|
|
|
double target_position_rad = 2;
|
|
|
|
|
optional double target_velocity_rad_s = 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message CyclicVelocitySetpoint {
|
|
|
|
|
uint64 sequence = 1;
|
|
|
|
|
double target_velocity_rad_s = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message CyclicPositionRequest {
|
|
|
|
|
oneof payload {
|
|
|
|
|
CyclicStreamOpen open = 1;
|
|
|
|
|
CyclicPositionSetpoint setpoint = 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message CyclicVelocityRequest {
|
|
|
|
|
oneof payload {
|
|
|
|
|
CyclicStreamOpen open = 1;
|
|
|
|
|
CyclicVelocitySetpoint setpoint = 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum CyclicStreamPhase {
|
|
|
|
|
CYCLIC_STREAM_PHASE_UNSPECIFIED = 0;
|
|
|
|
|
CYCLIC_STREAM_OPENED = 1;
|
|
|
|
|
CYCLIC_STREAM_APPLIED = 2;
|
|
|
|
|
CYCLIC_STREAM_STOPPED = 3;
|
|
|
|
|
CYCLIC_STREAM_WATCHDOG_EXPIRED = 4;
|
|
|
|
|
CYCLIC_STREAM_FAILED = 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message CyclicControlResponse {
|
|
|
|
|
CommandHeader.Feedback header = 1;
|
|
|
|
|
CyclicStreamPhase phase = 2;
|
|
|
|
|
uint64 sequence = 3;
|
|
|
|
|
uint64 dropped_setpoints = 4;
|
|
|
|
|
// Present for OPENED and terminal responses. APPLIED deliberately omits
|
|
|
|
|
// live status so one cyclic sample does not trigger extra fieldbus reads.
|
|
|
|
|
MotorStatus status = 5;
|
|
|
|
|
}
|