package pjisuv_msgs

import (
	"github.com/bluenviron/goroslib/v2/pkg/msg"
	"github.com/bluenviron/goroslib/v2/pkg/msgs/geometry_msgs"
	"github.com/bluenviron/goroslib/v2/pkg/msgs/sensor_msgs"
	"github.com/bluenviron/goroslib/v2/pkg/msgs/std_msgs"
)

type Header struct {
	msg.Package    `ros:"common_msgs"`
	SequenceNum    int32          `rosname:"sequence_num"`
	TimeStamp      float64        `rosname:"time_stamp"`
	ModuleName     string         `rosname:"module_name"`
	Version        string         `rosname:"version"`
	FaultVec       FaultVec       `rosname:"fault_vec"`
	TimeStatistics TimeStatistics `rosname:"time_statistics"`
}

type FaultVec struct {
	msg.Package      `ros:"common_msgs"`
	InfoVec          []FaultInfo `rosname:"info_vec"`
	ModuleFaultLevel int32       `rosname:"module_fault_level"`
}

type TimeStatistics struct {
	msg.Package      `ros:"common_msgs"`
	DevTimeStatusMsg []TimeStatus `rosname:"dev_time_status_msg"`
	SendingTimestamp float64      `rosname:"sending_timestamp"`
}
type FaultInfo struct {
	msg.Package  `ros:"common_msgs"`
	TimestampSec float64 `rosname:"timestamp_sec"`
	ModuleName   string  `rosname:"module_name"`
	Version      string  `rosname:"version"`
	ErrorCode    int32   `rosname:"error_code"`
	Msg          string  `rosname:"msg"`
	FaultLevel   int8    `rosname:"fault_level"`
	FaultType    int8    `rosname:"fault_type"`
}
type TimeStatus struct {
	msg.Package         `ros:"common_msgs"`
	Dtime               float64 `rosname:"dtime"`
	SourceNodeName      string  `rosname:"source_node_name"`
	DestinationNodeName string  `rosname:"destination_node_name"`
}

type Retrieval struct {
	msg.Package  `ros:"common_msgs"`
	Header       std_msgs.Header `rosname:"header"`
	GearPos      int16           `rosname:"GearPos"`      // 当前档位
	ActStrWhAng  float64         `rosname:"ActStrWhAng"`  // 实际方向盘转角
	AccPed1      float64         `rosname:"AccPed1"`      // 加速踏板开度第一路EDR
	AccPed2      float64         `rosname:"AccPed2"`      // 加速踏板开度第二路EDR
	BrkPedSts    int16           `rosname:"BrkPedSts"`    // 制动开关状态
	TurnSwitchLH int16           `rosname:"TurnSwitchLH"` // 左转向灯开关状态
	TurnSwitchRH int16           `rosname:"TurnSwitchRH"` // 右转向灯开关状态
}

type CicvMovingObject__ struct {
	msg.Package      `ros:"common_msgs"`
	Header           std_msgs.Header
	Id               uint32
	Label            string
	Probability      float32
	LabelProbability float32
	MotionStatus     uint32
	Ttc              float32
	Variance         float32
	DataSource       string
	LeftTopX         float32
	LeftTopY         float32
	RightTopX        float32
	RightTopY        float32
	LeftButtomX      float32
	LeftButtomY      float32
	RightButtomX     float32
	RightButtomY     float32
	MinZ             float32
	MaxZ             float32
	Pose             geometry_msgs.Pose
	Dimensions       geometry_msgs.Vector3
	Velocity         geometry_msgs.Twist
	Acceleration     geometry_msgs.Twist
	ConvexHull       geometry_msgs.PolygonStamped
	Speed            float32
	SpeedDirection   float32
	GlobalX          float32
	GlobalY          float32
	Lane             int32
	RelativeLane     int32
	GlobalLane       int32
}
type CommonCicvMovingObject struct {
	msg.Package      `ros:"common_msgs"`
	Header           std_msgs.Header
	Id               uint32
	Label            string
	Probability      float32
	LabelProbability float32
	MotionStatus     uint32
	Ttc              float32
	Variance         float32
	DataSource       string
	X1               float32
	Y1               float32
	X2               float32
	Y2               float32
	X3               float32
	Y3               float32
	X4               float32
	Y4               float32
	MinZ             float32
	MaxZ             float32
	Pose             geometry_msgs.Pose
	Dimensions       geometry_msgs.Vector3
	Velocity         geometry_msgs.Twist
	Acceleration     geometry_msgs.Twist
	ConvexHull       geometry_msgs.PolygonStamped
	Speed            float32
	SpeedDirection   float32
	GlobalX          float32
	GlobalY          float32
	Lane             int32
	RelativeLane     int32
	GlobalLane       int32
	ClusterPoints    sensor_msgs.PointCloud2
}
type CommonCicvMovingObjects struct {
	msg.Package `ros:"common_msgs"`
	Header      std_msgs.Header
	Num         int32
	Objects     []CommonCicvMovingObject
}
type Vector3WithCovariance struct {
	msg.Package `ros:"common_msgs"`
	X           UnsureVar
	Y           UnsureVar
	Z           UnsureVar
}

type PoseEuler struct {
	msg.Package `ros:"common_msgs"`
	Position    Vector3WithCovariance
	Rotation    EulerWithCovariance
}

type DRPoseWithTime struct {
	msg.Package `ros:"common_msgs"`
	Week        int32
	Utctime     float64
	DrTime      float64
	PoseEuler   PoseEuler
}
type UnsureVar struct {
	msg.Package `ros:"common_msgs"`
	Variable    float64
	VarStd      float64
}

type EulerWithCovariance struct {
	msg.Package `ros:"common_msgs"`
	Roll        UnsureVar
	Pitch       UnsureVar
	Yaw         UnsureVar
}
type LLH struct {
	msg.Package `ros:"common_msgs"`
	Lat         UnsureVar
	Lon         UnsureVar
	Height      UnsureVar
}
type NavStatus struct {
	msg.Package `ros:"common_msgs"`
	UtcTime     float64
	GpsStatus   int8
	PosStatus   int32
	AttStatus   int32
	InitStatus  int32
	SateNum     int32
	Hdop        float32
	Pdop        float32
	DiffAge     float32
}
type Pose struct {
	msg.Package    `ros:"common_msgs"`
	PoseEuler      PoseEuler
	PoseQuaternion PoseQuaternion
	Status         int8
}
type Quaternion struct {
	msg.Package `ros:"common_msgs"`
	X           float64
	Y           float64
	Z           float64
	W           float64
}
type Vector3 struct {
	msg.Package `ros:"common_msgs"`
	X           float64
	Y           float64
	Z           float64
}

type PoseQuaternion struct {
	msg.Package   `ros:"common_msgs"`
	Position      Vector3WithCovariance
	Quaternion    Quaternion
	RpyCovariance Vector3
}

type Twist struct {
	msg.Package     `ros:"common_msgs"`
	Velocity        Vector3WithCovariance
	AngularVelocity Vector3WithCovariance
}
type CommonVehicleCmd struct {
	msg.Package             `ros:"common_msgs"`
	Header                  std_msgs.Header
	ICPVCmdStrAngle         float64 `rosname:"ICPV_Cmd_StrAngle"`
	ICPVCmdStrAngleLimit    float64 `rosname:"ICPV_Cmd_StrAngleLimit"`
	ICPVCmdEPSXBWEn         float64 `rosname:"ICPV_Cmd_EPSXBW_En"`
	ICPVCmdEPSDir           float64 `rosname:"ICPV_Cmd_EPSDir"`
	ICPVCmdStrAngleSpd      float64 `rosname:"ICPV_Cmd_StrAngleSpd"`
	ICPVCmdChecksum         float64 `rosname:"ICPV_Cmd_Checksum"`
	ICPVCmdRCnt             float64 `rosname:"ICPV_Cmd_RCnt"`
	ICPVCmdTgtSft           float64 `rosname:"ICPV_Cmd_TgtSft"`
	ICPVCmdAccPelEnable     float64 `rosname:"ICPV_Cmd_AccPelEnable"`
	ICPVCmdBrkPelEnable     float64 `rosname:"ICPV_Cmd_BrkPelEnable"`
	ICPVCmdAccPelPosAct     float64 `rosname:"ICPV_Cmd_AccPelPosAct"`
	ICPVCmdAccPelPosActInv  float64 `rosname:"ICPV_Cmd_AccPelPosActInv"`
	ICPVCmdBrkPelPosAct     float64 `rosname:"ICPV_Cmd_BrkPelPosAct"`
	ICPVCmdBrkPelPosActInv  float64 `rosname:"ICPV_Cmd_BrkPelPosActInv"`
	ICPVCmdBrkLightReq      float64 `rosname:"ICPV_Cmd_BrkLightReq"`
	ICPVCmdTgtSftEnable     float64 `rosname:"ICPV_Cmd_TgtSftEnable"`
	ICPVCmdATOModeEnable    float64 `rosname:"ICPV_Cmd_ATOModeEnable"`
	CANICPVVCUControlEPBREQ float64 `rosname:"CAN_ICPV_VCU_Control_EPB_REQ"`
	CANICPVVCUBUZZING       float64 `rosname:"CAN_ICPV_VCU_BUZZING"`
	TargetX                 float64
	TargetY                 float64
	Velocity                float64
	CalcAccel               float64
	AutoMode                int16
}
