

syntax = "proto3";
package cmvr.api;
import "cmvr/api/common.proto";

message JointCmd {
  string joint_name = 1;  // 关节名称
  double rad = 2;         // 弧度
  double vel = 3;         // 角速度，rad/s
}

message Pose3D{
  double x = 1;
  double y = 2;
  double z = 3;
  double rx = 4;
  double ry = 5;
  double rz = 6;
}

enum RobotCartesian{
  X = 0;
  Y = 1;
  Z = 2;
  RX = 3;
  RY = 4;
  RZ = 5;
} ;
enum RobotJointIndexDirection{
  FORWARD = 0;
  BACKWARD = 1;
  X_POSITIVE = 2;   // X轴正向
  X_NEGATIVE = 3;  // X轴负向
  Y_POSITIVE = 4;  // Y轴正向
  Y_NEGATIVE = 5;   // Y轴负向
  Z_POSITIVE = 6;   // Z轴正向
  Z_NEGATIVE = 7;   // Z轴负向
  ROTATE_X = 8;   // 绕X轴旋转
  ROTATE_Y = 9;    // 绕Y轴旋转
  ROTATE_Z = 10;     // 绕Z轴旋转
}
message MoveJ{
  message Request{
    CommandHeader.Request header = 1;
    repeated JointCmd cmds = 2;
    double vel = 3;
    double acc = 4;
  }

  message Response{
    CommandHeader.Feedback header= 1;
  }

}

message MoveL{

  message Request{
    CommandHeader.Request header = 1;
    string ee_link = 2; //连杆名称
    Pose3D targetPose = 3;
    double vel = 4;
    double acc = 5;
  }

  message Response{
    CommandHeader.Feedback header= 1;
  }

}

message SpeedJ{

  message Request{
    CommandHeader.Request header = 1;
    string joint_name = 2;
    double vel = 3;
    double acc = 4;
    RobotJointIndexDirection dir = 5;
  }

  message Response{
    CommandHeader.Feedback header= 1;
  }
}

message SpeedL{
  message Request{
    CommandHeader.Request header = 1;
    string ee_link = 2;
    double vel = 3;
    double acc = 4;
    RobotJointIndexDirection dir = 5;
    RobotCartesian cart = 6;
  }

  message Response{
    CommandHeader.Feedback header= 1;
  }
}

// 关节状态消息
message JointState {
  repeated string name = 1;       // 关节名称
  repeated double position = 2;   // 关节位置
  repeated double velocity = 3;   // 可选：关节速度
  repeated double effort = 4;     // 可选：关节力矩
  double timestamp = 5;           // 可选：时间戳
}

// 返回消息
message JointResponse {
  CommandHeader.Feedback header= 1;
  repeated JointState state = 2;
}

// 请求消息（可选）
message JointRequest {
  CommandHeader.Request header = 1;
}


message GetPose{
  message Request{
    CommandHeader.Request header = 1;
    string base_link = 2;
    string ee_link = 3;
  }

  message Response{
    CommandHeader.Feedback header= 1;
    Pose3D pose = 2;
  }
}