SMORES Robot Platform Simulation
Modlab at Penn, ASL at Cornell
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends
CommandManagement.hh
1 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 // Author: Edward Yunkai Cui
3 // Description: Those classes defined in this file are used by the
4 // command manager in the world plugin
5 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 #ifndef _GAZEBO_COMMAND_MANAGEMENT_HH_
7 #define _GAZEBO_COMMAND_MANAGEMENT_HH_
8 
9 #include <boost/shared_ptr.hpp>
10 
11 #include "command_message.pb.h"
12 
13 using std::string;
14 using std::vector;
16 typedef boost::shared_ptr<command_message::msgs::CommandMessage> CommandPtr;
17 
18 namespace gazebo{
21 typedef boost::shared_ptr<SmoresModule> SmoresModulePtr;
25 {
26  public:
28 
36  SpecialCommand(int commandtype, string modelname1, string modelname2,
37  int node1, int node2);
39 
43  SpecialCommand(int commandtype);
51  string Module1;
53  string Module2;
55  int Node1;
57  int Node2;
58 }; // class SpecialCommand
60 class CommandPro // abbr for Command protocol
61 {
62  public:
64  CommandPro();
66 
67  CommandPro(CommandPtr command);
69 
73  CommandPro(CommandPtr command, unsigned int timer);
75  ~CommandPro();
77 
78  void SetTimer(unsigned int timer);
80 
81  void SetCondition(string condition);
83 
84  void SetDependency(string dependency);
86 
87  void SetSpecialCommand(SpecialCommand specialcommand);
91  bool TimeBased;
93  unsigned int TimeInterval; // Millisecond
97  string ConditionID;
101  string Dependency;
106 }; // class CommandPro
110 {
111  public:
113 
114  ModuleCommands(SmoresModulePtr which_module);
116  ~ModuleCommands();
118  SmoresModulePtr WhichModule;
120  vector<CommandPro> CommandSquence;
127 }; // class ModuleCommands
128 }
129 #endif
~CommandPro()
Destructor.
Definition: CommandManagement.cc:62
CommandPtr ActualCommandMessage
A pointer of the CommandMessage object.
Definition: CommandManagement.hh:89
bool SpecialCommandFlag
Flag indicates whether this command is a special command.
Definition: CommandManagement.hh:103
gazebo name space
Definition: system_gui.cc:41
A class used to store a cluster of nodes which has rigid connectivity.
Definition: SmoresModule.hh:29
void SetDependency(string dependency)
Set dependency string of the current command.
Definition: CommandManagement.cc:73
SmoresModulePtr WhichModule
Pointer of the parent SmoresModule object.
Definition: CommandManagement.hh:118
int Node1
Node id of the first module.
Definition: CommandManagement.hh:55
bool ConditionCommand
Flag indicates whether this command has a condition.
Definition: CommandManagement.hh:95
Definition: CommandManagement.hh:109
unsigned int TimeInterval
Timer of the current command, unit: msec.
Definition: CommandManagement.hh:93
SpecialCommand Command
Special command object.
Definition: CommandManagement.hh:105
A data structure that stores normal command message.
Definition: CommandManagement.hh:60
bool ConditionOnOtherCommand
Flag indicates whether this command has a dependency.
Definition: CommandManagement.hh:99
bool FinishedFlag
The indicator of whether a command has been finished.
Definition: CommandManagement.hh:122
~SpecialCommand()
Destructor.
Definition: CommandManagement.cc:29
void SetCondition(string condition)
Set condition string of the current command.
Definition: CommandManagement.cc:68
SpecialCommand()
Constructor.
Definition: CommandManagement.cc:21
~ModuleCommands()
Destructor.
Definition: CommandManagement.cc:90
void SetTimer(unsigned int timer)
Set a timer for the current command.
Definition: CommandManagement.cc:63
boost::shared_ptr< SmoresModule > SmoresModulePtr
Smart pointer of the SmoresModule object.
Definition: CommandManagement.hh:19
ModuleCommands(SmoresModulePtr which_module)
Constructor.
Definition: CommandManagement.cc:83
bool TimeBased
Flag indicates whether the current command is a time based command.
Definition: CommandManagement.hh:91
string Module2
Name of the second module.
Definition: CommandManagement.hh:53
string Dependency
The dependency string.
Definition: CommandManagement.hh:101
Definition: CommandManagement.hh:24
int Node2
Node id of the second module.
Definition: CommandManagement.hh:57
bool ReceivedFlag
The indicator of whether a command has been received by model.
Definition: CommandManagement.hh:124
int CommandType
CommandType: 0 no special command; 1 connect; 2 disconnect.
Definition: CommandManagement.hh:49
string Module1
Name of the first module.
Definition: CommandManagement.hh:51
CommandPro()
Constructor.
Definition: CommandManagement.cc:30
vector< CommandPro > CommandSquence
The vector of command array.
Definition: CommandManagement.hh:120
bool ExecutionFlag
The indicator of whether a command has been executing.
Definition: CommandManagement.hh:126
string ConditionID
The condition string.
Definition: CommandManagement.hh:97
void SetSpecialCommand(SpecialCommand specialcommand)
Make current command a special command.
Definition: CommandManagement.cc:78