123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- //
- // Created by gf on 23-7-21.
- // 自定义类型
- //
- #ifndef NAVIGATION_CUSTOM_TYPE_H
- #define NAVIGATION_CUSTOM_TYPE_H
- #include <map>
- //////////////////////////////////////////////////
- /// 封装的enum模板类,解决原生enum无法参与位运算问题
- template<typename Enum>
- class MyEnum {
- using Self = MyEnum<Enum>;
- using EnumType = Enum;
- public:
- MyEnum(const MyEnum &other)
- : i(other.i) {
- }
- MyEnum(const Enum &e)
- : i((int) e) {
- }
- MyEnum(const int ival)
- : i(ival) {
- }
- operator int() const {
- return i;
- }
- MyEnum operator|(const MyEnum &another) {
- MyEnum g;
- g.i = another.i | Self::i;
- return g;
- }
- MyEnum operator|(const EnumType f) {
- return *this | MyEnum(f);
- }
- MyEnum operator&(const MyEnum &another) {
- MyEnum g;
- g.i = another.i & Self::i;
- return g;
- }
- MyEnum operator&(const EnumType f) {
- return *this & MyEnum(f);
- }
- private:
- int i;
- };
- //////////////////////////////////////////////////
- //////////////////////////////////////////////////
- /// MPC返回值
- enum MpcError {
- success = 0,
- no_solution = 1,
- failed = 2,
- unknown
- };
- //////////////////////////////////////////////////
- //////////////////////////////////////////////////
- /// 基准可选方向
- enum Direction {
- eForward = 0x0001,
- eBackward = 0x0002,
- eLeft = 0x0004,
- eRight = 0x0008
- };
- //////////////////////////////////////////////////
- //////////////////////////////////////////////////
- /// AGV运动模式(最低1位:0单车,1整车。低2位:0同向,1反向。低3位:0主车在前,1主车在后)
- enum ActionMode{
- eSingle = 0x0000,
- eDouble = 0x0001,
- eMainInForward = 0x0000,
- eMainInBackward = 0x0008,
- eChildSameToMain = 0x0000,
- eChildOppositeToMain = 0x0002
- };
- //using ActionModes = MyEnum<ActionMode>;
- //////////////////////////////////////////////////
- //////////////////////////////////////////////////
- /// AGV指令类型
- enum ActionType {
- eReady = 0,
- eStop = 0,
- eRotation = 1,
- eHorizontal = 2,
- eVertical = 3,
- eClampClose = 5,
- eClampHalfOpen = 6,
- eLifterRise = 7, //提升机构上升
- eLifterDown =8,
- eClampFullyOpen = 9
- };
- //////////////////////////////////////////////////
- //////////////////////////////////////////////////
- /// 提升机构运动状态
- enum LifterStatus {
- eInvalid = 0,
- eRose = 1,//上升到位
- eDowned = 2//下降到位
- };
- //////////////////////////////////////////////////
- //////////////////////////////////////////////////
- /// 并行夹持和提升机构运作
- enum eClamLiftActionType{
- eByteCLampClose = 1,
- eByteClampHalfOpen=2,
- eByteClampFullyOpen=4,
- eByteLifterDown=8,
- eByteLifterUp=16
- };
- //////////////////////////////////////////////////
- //////////////////////////////////////////////////
- /// 指令流程类型
- enum eSequenceType{
- eSequenceDefault = 0,
- eSequencePark = 1,
- eSequencePick = 2
- };
- //////////////////////////////////////////////////
- //////////////////////////////////////////////////
- /// plc区域+编号载车板 对应 车位表
- enum eRegionId{
- eRegion0 = 0,
- eRegion1 = 1,
- eRegion2,
- eRegion3,
- eRegion4,
- eRegion5,
- eRegion6,
- eRegion7,
- eRegion8,
- eRegion9,
- eRegion10,
- eRegion11
- };
- enum eCarrierIdInRegionId{
- eCarrier0 = 0,
- eCarrier1 = 1,
- eCarrier2,
- eCarrier3,
- eCarrier4,
- eCarrier5,
- eCarrier6,
- eCarrier7,
- eCarrier8,
- eCarrier9,
- eCarrier10,
- eCarrier11
- };
- typedef std::pair<short, short > Region_Carry;
- typedef std::map<int ,Region_Carry> SpaceNo2Region_Carry;
- //////////////////////////////////////////////////
- #endif //NAVIGATION_CUSTOM_TYPE_H
|