Conscience Core
CommandFollowEntity.h
Go to the documentation of this file.
1 //
2 // CommandFollowEntity.h
3 // ConscienceRobotManager
4 //
5 // Created by Max Lhermitte on 15/02/2023.
6 // Copyright © 2023 IliesZaoui. All rights reserved.
7 //
8 
9 #ifndef CommandFollowEntity_h
10 #define CommandFollowEntity_h
11 
12 #include "Command.h"
15 
19 };
20 
22 
24 public:
27  float angle;
28  float distance;
29  float height;
32 
33  inline static const CommandTypeId COMMAND_ID = "FOLLOW_ENTITY";
34  CommandFollowEntityParams() = default;
35  CommandFollowEntityParams(const ptr<CscEntityReflexion> &masterReference, ptr<CscEntityReflexion> entitySlaveReflexion, float angle, float distance, float height, int knowledgeId, FollowRequestType requestType)
36  : masterReference(masterReference),
37  entitySlaveReflexion(entitySlaveReflexion),
38  angle(angle),
39  distance(distance),
40  height(height),
41  knowledgeId(knowledgeId),
42  requestType(requestType) {}
43 
45  }
46 
47  string toString() const {
48  return "FollowEntityParams: masterThere=" + boolToString(masterReference != nullptr) + " slaveThere=" + boolToString(entitySlaveReflexion != nullptr) + " angle=" + to_string(angle) + " distance=" + to_string(distance) + " height=" + to_string(height) + " knowledgeId=" + to_string(knowledgeId) + " requestType=" + to_string(requestType);
49  }
50 };
51 
56  int status;
57 };
62  string message;
63  bool success;
65 };
66 
68 
69 public:
70  inline static const CommandTypeId COMMAND_ID = "FOLLOW_ENTITY";
71 
78 
79  ptr<CscEntityReflexion> getMasterReflexion() const;
80  ptr<CscEntityReflexion> getEntitySlaveReflexion() const;
81  const FollowRequestType getFollowRequestType() const;
82 
83 protected:
84  const CscCommandExecutionResultObject<CommandFollowEntityResult> *doExecute(CscEnvironmentSimulator &environmentSimulator) override;
85  ptr<CscEntityReflexion> getEntityReflexion() const override;
86  const CscState *getCurrentState() const;
87 
88 private:
89  ptr<CscEntityReflexion> masterReference;
90  ptr<CscEntityReflexion> entitySlaveReflexion;
91  const float angle;
92  const float distance;
93  const float height;
94  const int knowledgeId;
95  const CscState *currentState;
96  FollowRequestType requestType;
97 };
98 
103 
104 }
105 #endif
conscience_core::bridging::commands::CommandFollowEntityParams::CommandFollowEntityParams
CommandFollowEntityParams(const ptr< CscEntityReflexion > &masterReference, ptr< CscEntityReflexion > entitySlaveReflexion, float angle, float distance, float height, int knowledgeId, FollowRequestType requestType)
Definition: CommandFollowEntity.h:35
nlohmann::to_string
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
Definition: json.hpp:26470
conscience_core::bridging::commands::CommandFollowEntityParams::~CommandFollowEntityParams
~CommandFollowEntityParams()
Definition: CommandFollowEntity.h:44
CSC_DLL_IMPORTEXPORT
#define CSC_DLL_IMPORTEXPORT
Definition: os.h:34
conscience_core::bridging::commands::CommandFollowEntityResult::success
bool success
Definition: CommandFollowEntity.h:63
conscience_core::bridging::commands::CommandFollowEntityResult::message
string message
Definition: CommandFollowEntity.h:62
conscience_core::bridging::commands::CommandFollowEntityParams::entitySlaveReflexion
ptr< CscEntityReflexion > entitySlaveReflexion
Definition: CommandFollowEntity.h:26
FollowRequestType_STOP
@ FollowRequestType_STOP
Definition: CommandFollowEntity.h:18
conscience_core::bridging::commands::CommandFollowEntityResultStatus::status
int status
Definition: CommandFollowEntity.h:56
conscience_core::bridging::commands::CommandFollowEntityParams::knowledgeId
int knowledgeId
Definition: CommandFollowEntity.h:30
conscience_core::bridging::commands::CommandFollowEntityParams::height
float height
Definition: CommandFollowEntity.h:29
Command.h
conscience_core::bridging::commands::CommandFollowEntityParams::distance
float distance
Definition: CommandFollowEntity.h:28
conscience_core::bridging::commands::CommandFollowEntityParams::requestType
FollowRequestType requestType
Definition: CommandFollowEntity.h:31
conscience_core::bridging::commands::CommandTypeId
string CommandTypeId
Definition: Command.h:29
conscience_core::bridging::commands::CommandFollowEntityResult::status
CommandFollowEntityResultStatus * status
Definition: CommandFollowEntity.h:64
conscience_utils::boolToString
string boolToString(bool value)
Definition: conscience_util.cpp:99
conscience_core::bridging::commands::CommandFollowEntityParams::toString
string toString() const
Definition: CommandFollowEntity.h:47
conscience_core::bridging::commands
Definition: cartographyCommands.cpp:4
conscience_core::bridging::commands::CommandFollowEntityResult
Definition: CommandFollowEntity.h:61
COMMAND_RESULT_JSON_SERIALIZER
#define COMMAND_RESULT_JSON_SERIALIZER(TClass,...)
Definition: CommandExecutionResult.h:10
CscState
Definition: CscState.h:24
conscience_core::bridging::commands::CscCommand
Definition: Command.h:40
conscience_core::bridging::commands::CommandFollowEntityParams::angle
float angle
Definition: CommandFollowEntity.h:27
FollowRequestType_START
@ FollowRequestType_START
Definition: CommandFollowEntity.h:17
conscience_core::bridging::commands::CommandFollowEntityParams::masterReference
ptr< CscEntityReflexion > masterReference
Definition: CommandFollowEntity.h:25
conscience_core::bridging::commands::CommandFollowEntityResultStatus
Definition: CommandFollowEntity.h:55
CommandResultSpec.h
COMMAND_TYPE_BUILDER
#define COMMAND_TYPE_BUILDER(PREFIX, COMMAND_REGISTER_className,...)
Definition: CscCommandAutoParse.h:515
conscience_core::bridging::commands::CommandFollowEntityParams
Definition: CommandFollowEntity.h:23
CscEnvironmentSimulator
Definition: CscEnvironmentSimulator.h:31
conscience_core::bridging::commands::COMMAND_REGISTER
COMMAND_REGISTER(CommandFollowKinematicTrajectory, ptr< CscEntityReflexion >, int, const CscState *, string, string, string, string, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float)
CscCommandAutoParse.h
conscience_core::bridging::commands::result::CscCommandExecutionResultObject
Definition: CommandExecutionResult.h:93
FollowRequestType
FollowRequestType
Definition: CommandFollowEntity.h:16
conscience_core::bridging::commands::CommandFollowEntity
Definition: CommandFollowEntity.h:67
ptr
std::shared_ptr< T > ptr
Definition: CscCommon.h:29