123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- #ifndef __COMMON_DEF_H__
- #define __COMMON_DEF_H__
- #include <vector>
- #include <string>
- #include <map>
- #include <boost/thread/shared_mutex.hpp>
- typedef boost::unique_lock<boost::shared_mutex> U_Lock;
- typedef boost::shared_lock<boost::shared_mutex> S_Lock;
- struct Point {
- float x;
- float y;
- };
- struct Pose {
- float x;
- float y;
- float theta;
- };
- struct MapPoint {
- std::string name; //点名
- std::string id; //点ID
- std::string type; //点类型
-
- Pose pose; //点坐标
- };
- struct MapPath {
- std::string name; //路径名
- std::string id; //路径ID
- std::string type; //类型 直线,圆弧
-
- MapPoint start; //起始点ID
- MapPoint end; //终点ID
- float max_linear; //最大线速度
- float max_angular; //最大角速度
- bool enable; //能否使用
- bool forward; //是否能从起点到终点行驶
- bool reverse; //是否能从终点到起点行驶
- bool obstacle; //是否避障
- double drive_angle; //行驶角度
- };
- using Path = std::vector<Pose>;
- using Points = std::vector<Point>;
- using Area = std::vector<Point>;
- struct MapInfo {
- std::string name; //地图名
- std::string id; //地图ID
- int floor; //地图楼层
- Points origin_map; //原始地图数据
- Points shadow_map; //影子地图数据
- Points reflector_map; //反光板地图数据
- std::map<std::string, MapPath> paths; //地图路径 <id>
- std::map<std::string, MapPoint> points; //地图点 <id>
- };
- struct Map { //地图信息
- std::string name; //地图名
- std::string id; //地图ID
- };
- struct EmcyInfo { //急停信息
- bool hardware; //硬件急停
- bool software; //软件急停
- bool traffic; //交通管制急停
- };
- struct BatteryInfo { //电池信息
- bool charging; //是否充电
- double soc; //电量百分比
- double voltage; //电压
- double electric; //电流
- };
- struct LocationInfo { //定位信息
- std::string map_id; //当前地图ID
- double x; //x坐标
- double y; //y坐标
- double theta; //角度
- };
- struct ResourceInfo {
- std::string current_pose_id; //AGV当前所在点ID
- std::string current_pose_name; //AGV当前所在点名
- std::vector<MapPoint> path; //AGV任务路径
- };
- struct NavigationConfigInfo {
- Area origin_obstacle_area; //原始避障区域
- Area extend_obstacle_area; //扩展避障区域
- std::vector<Area> shield_area; //屏蔽区域
- float max_linear; //最大线速度
- float max_angular; //最大角速度
- float min_linear; //最小线速度
- float min_angular; //最小角速度
- float error_x; //到点x方向误差
- float error_y; //到点y方向误差
- float error_theta; //到点角度误差
- float dec; //减速度
- float acc; //加速度
- float slow_dist; //避障减距离
- float stop_dist; //避障停止距离
- float look_up_dist; //前瞻距离
- bool break_path; //是否分段导航
- bool face_angle; //是否转到朝向角度
- };
- struct LaserConfigInfo {
- std::string frame_id; //激光frame_id
- std::string topic; //激光数据topic
- float tf_x; //tf 坐标
- float tf_y;
- float tf_z;
- float tf_roll;
- float tf_pitch;
- float tf_yaw;
- };
- struct RobotInfo {
- std::string name; //AGV名
- std::string id; //AGV ID
- std::string type; //AGV类型 (二轮差速,单舵轮, 双舵轮, 四舵轮)
- std::string state; //AGV状态 (空闲,工作中,充电中)
- bool located; //AGV是否定位
- LocationInfo location; //定位信息
- std::map<std::string, MapInfo> maps; //地图信息 <地图id, 地图信息>
- EmcyInfo emcy; //急停信息
- BatteryInfo battery; //电池信息
- std::map<std::string, bool> gpio; //io信息 <io名,状态>
- ResourceInfo resource; //占用资源信息
- NavigationConfigInfo nav_config; //导航参数
- std::map<std::string, LaserConfigInfo> laser; //雷达参数
- };
- struct TaskInfo {
- std::string name; //任务名
- std::string id; //任务ID 唯一性
- std::string state; //任务状态 准备中 执行中 待执行 完成 终止
- unsigned int priority; //优先级 0~9 数值越大优先级越高,默认为0
- std::string start_time; //任务开始时间
- std::string finish_time; //任务完成时间
- std::string info; //任务信息
- };
- #endif
|