syntax = "proto3";

package NavMessage;

message LidarOdomStatu {
    float x = 1;
    float y = 2;
    float theta = 3;
    float v = 4;
    float vth = 5;
}

message AgvStatu {
    float v = 1;
    float w = 2;
    int32 clamp = 3;    //夹持状态  0，中间状态，1夹紧到位，2，打开到位，
    int32 clamp_other = 4; //另外一节
    int32 lifter = 5;   //提升机构 0中间状态，1上升到位， 2下降到位
    int32 lifter_other = 6;     //另外一节
}

message ToAgvCmd {
    int32 H = 1;  //心跳
    int32 M = 2;    //模式：2整车模式，1：单车
    int32 T = 3; // 1:原地旋转, 2:横移, 3:MPC巡线/前进, 5:夹持, 6:松夹持, 7:提升机构抬升, 8:抬升机构下降, 其他/未接收到：停止
    float V = 4;  //角速度
    float W = 5;  //线速度
    float L = 6;  //轴距
    int32 P = 7; //车位编号
    float D = 8; //距目标点距离
    int32 end = 9;
}

message Pose2d
{
    float x = 1;
    float y = 2;
    float theta = 3;
}

message PathNode //导航路径点及精度
{
    float x = 1;    //目标点坐标
    float y = 2;
    float l = 3;    //目标点旋转矩形方程，代表精度范围
    float w = 4;
    float theta = 5;
    string id = 6;
}

message Trajectory
{
    repeated Pose2d poses = 1;
}

//----------------------------
message NewAction //进库，出库，轨迹导航，夹持，松夹持
{
    int32 type = 1; //1,进库，2，出库，3，自动选择动作导航，4，保证agv朝前导航，5，汽车模型导航，6:夹持，7:松夹持，8:切换模式， 9:提升机构提升， 10: 提升机构下降
    PathNode spaceNode = 2; //进出库起点
    PathNode passNode = 3; //进出库途径点
    PathNode streetNode = 4; //进出库终点
    repeated PathNode pathNodes = 5;//导航路径点

    float wheelbase = 6;        //切换模式，轴距信息
    int32 changedMode = 7; //1:切换单车模式，2:切换双车模式
}
//-----------------------------

message NavCmd
{
    int32 action = 1;  //  0 开始任务，1 pause， 2 continue ，3 cancel,4:切换到双车模式，5:切换到单车模式,
    string key = 2;
    repeated NewAction newActions = 5;
}

message NavResponse {
    int32 ret = 1;
    string info = 2;
}

message ManualCmd {
    string key = 1;
    int32 operation_type = 2; // 1:旋转, 2:前后平移(X方向), 3:左右平移(Y方向):
    float velocity = 3; // 正数为正方向，负数为负方向
}

service NavExcutor {
    rpc Start (NavCmd) returns (NavResponse) {}
    rpc Cancel (NavCmd) returns (NavResponse) {}
    rpc ManualOperation (ManualCmd) returns (NavResponse) {}
}

message NavStatu
{
    int32 statu = 1; //0:ready  1:原地旋转，2：Horizon,3:vrtical,4:MPC,5:夹持开，6:夹持关，7:提升机构提升， 8: 提升机构下降
    bool main_agv = 2; //是否是两节控制plc
    int32 move_mode = 3; //运动模式，1：single，2：双车
    LidarOdomStatu odom = 4;
    string key = 5; // 任务唯一码
    Trajectory selected_traj = 6;
    Trajectory predict_traj = 7;
    bool in_space = 8;  //是否在车位/正在进入车位
    string space_id = 9;
}
message RobotStatu
{
    float x = 1;
    float y = 2;
    float theta = 3;
    AgvStatu agvStatu = 4;
}
