2025-08-22 16:57:29 +08:00
|
|
|
|
//
|
|
|
|
|
|
// Created by xtkuang on 2025/5/7.
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef CMVR_ES_STATE_DEFINE_H
|
|
|
|
|
|
#define CMVR_ES_STATE_DEFINE_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <atomic>
|
|
|
|
|
|
#include <cmath>
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
#include <set>
|
|
|
|
|
|
|
|
|
|
|
|
#include "utils/math/geometry.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace cmvr::device{
|
|
|
|
|
|
enum Lifecycle{
|
|
|
|
|
|
INIT, // 初始化:设备刚创建或刚上电,正在初始化
|
|
|
|
|
|
READY, // 就绪:设备已初始化完成,可以开始工作
|
|
|
|
|
|
RUNNING,// 运行中:设备正在正常工作或采集
|
|
|
|
|
|
ERROR, // 错误:设备发生故障或异常,不能正常工作
|
|
|
|
|
|
STOP, // 停止:设备已停止工作,但没有严重错误
|
|
|
|
|
|
ESTOP // 急停:设备处于紧急停止状态,通常需要人工干预才能恢复
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum AudioFormat {
|
|
|
|
|
|
WAV,
|
|
|
|
|
|
MP3,
|
|
|
|
|
|
AAC,
|
|
|
|
|
|
OGG,
|
|
|
|
|
|
FLAC,
|
|
|
|
|
|
UNKNOWN
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------- AGV -------------------------------------
|
|
|
|
|
|
typedef struct{
|
|
|
|
|
|
|
|
|
|
|
|
} AGVState;
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------- robot -------------------------------------
|
|
|
|
|
|
typedef enum {
|
2025-09-19 15:06:32 +08:00
|
|
|
|
FORWARD, BACKWARD,
|
|
|
|
|
|
X_POSITIVE, // X轴正向
|
|
|
|
|
|
X_NEGATIVE, // X轴负向
|
|
|
|
|
|
Y_POSITIVE, // Y轴正向
|
|
|
|
|
|
Y_NEGATIVE, // Y轴负向
|
|
|
|
|
|
Z_POSITIVE, // Z轴正向
|
|
|
|
|
|
Z_NEGATIVE, // Z轴负向
|
|
|
|
|
|
// 角度方向也可以添加
|
|
|
|
|
|
ROTATE_X, // 绕X轴旋转
|
|
|
|
|
|
ROTATE_Y, // 绕Y轴旋转
|
|
|
|
|
|
ROTATE_Z // 绕Z轴旋转
|
2025-08-22 16:57:29 +08:00
|
|
|
|
} RobotJointIndexDirection;
|
|
|
|
|
|
|
2025-09-19 15:06:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-08-22 16:57:29 +08:00
|
|
|
|
/// robot cartesian index
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
|
X, Y, Z, RX, RY, RZ
|
|
|
|
|
|
} RobotCartesian;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2025-10-09 16:31:21 +08:00
|
|
|
|
std::string name;
|
2025-08-22 16:57:29 +08:00
|
|
|
|
bool is_ready;
|
|
|
|
|
|
bool power_on;
|
|
|
|
|
|
double position;
|
|
|
|
|
|
double velocity;
|
|
|
|
|
|
double current;
|
|
|
|
|
|
double torque;
|
|
|
|
|
|
double target_position;
|
|
|
|
|
|
double target_velocity;
|
|
|
|
|
|
int target_feedback_gain;
|
|
|
|
|
|
double target_feedforward_torque;
|
|
|
|
|
|
double temperature;
|
|
|
|
|
|
double voltage;
|
|
|
|
|
|
} JointState;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct{
|
|
|
|
|
|
std::vector<double> temperature;
|
|
|
|
|
|
std::vector<double> voltage;
|
|
|
|
|
|
std::vector<double> joint_positions;
|
|
|
|
|
|
bool error;
|
|
|
|
|
|
std::string error_msg;
|
|
|
|
|
|
} RobotState;
|
|
|
|
|
|
|
|
|
|
|
|
struct CameraState {
|
|
|
|
|
|
bool is_initialized; ///< 是否已初始化
|
|
|
|
|
|
bool is_opened;
|
|
|
|
|
|
bool is_streaming; ///< 是否正在采集视频数据
|
|
|
|
|
|
bool is_recording;
|
|
|
|
|
|
bool is_error;
|
|
|
|
|
|
std::string error_message;
|
|
|
|
|
|
int fps;
|
|
|
|
|
|
int width;
|
|
|
|
|
|
int height;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// @brief 从 XML 或其他配置中读取的相机网络参数
|
|
|
|
|
|
struct CameraConfig {
|
|
|
|
|
|
std::string ipAddress; ///< 相机 IP 地址
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct{
|
|
|
|
|
|
bool is_initialized; ///< 是否已初始化
|
|
|
|
|
|
bool is_running;
|
|
|
|
|
|
bool is_recording;
|
|
|
|
|
|
bool is_error;
|
|
|
|
|
|
int volume; // 0~100, 支持软音量调节
|
|
|
|
|
|
std::string error_message;
|
|
|
|
|
|
} MicrophoneState;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct{
|
|
|
|
|
|
|
|
|
|
|
|
} GripperState;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct{
|
|
|
|
|
|
int angle; //自由度角度
|
|
|
|
|
|
int speed; //自由度速度
|
|
|
|
|
|
int force; //实际受力
|
|
|
|
|
|
int position; //执行器位置
|
|
|
|
|
|
int current; //执行器实际电流
|
|
|
|
|
|
int temperature; //执行器温度
|
|
|
|
|
|
int error; //执行器故障信息
|
|
|
|
|
|
std::vector<std::string> error_message;
|
|
|
|
|
|
} RH56DFTPDexHand;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct{
|
|
|
|
|
|
bool is_initialized; //是否初始化
|
|
|
|
|
|
RH56DFTPDexHand hands[6]; // 包含6个自由度状态
|
|
|
|
|
|
} DexHandState;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
|
float voltage; //< 电压(V)
|
|
|
|
|
|
float current; //< 电流(A)
|
|
|
|
|
|
float temperature; //< 温度(°C)
|
|
|
|
|
|
int charge_percentage; //< 剩余电量(%)
|
|
|
|
|
|
bool is_charging; //< 是否正在充电
|
|
|
|
|
|
Lifecycle health; //< 电池健康状态
|
|
|
|
|
|
std::string vendor_info; //< 厂商信息(可选)
|
|
|
|
|
|
} BatteryState;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
|
bool is_initialized;
|
|
|
|
|
|
bool is_running;
|
|
|
|
|
|
bool is_decoding;
|
|
|
|
|
|
bool is_paused;
|
|
|
|
|
|
int volume; // 0~100, 支持软音量调节
|
|
|
|
|
|
} SpeakerState;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif //CMVR_ES_STATE_DEFINE_H
|