54 : TclClass(
"Plugin/UW/SC/MC")
78 Tcl &tcl = Tcl::instance();
81 if (strcasecmp(argv[1],
"getremovedmines") == 0) {
87 tcl.resultf(
"%d", count);
91 }
else if (argc == 4) {
92 if (strcasecmp(argv[1],
"addAUV") == 0) {
93 auv_follower.emplace_back(std::atoi(argv[2]), std::atoi(argv[3]));
95 tcl.resultf(
"%d",
"auv follower added\n");
100 return PlugIn::command(argc, argv);
113 return element.ctr_id == id;
117 auv->rov_position = p;
119 if (auv->rov_status) {
120 auto mine = auv->rov_mine.end() - 1;
123 mine->track_position->getDist(p) == 0)
129 <<
" UwMissionCoordinatorModule::recvSyncClMsg()"
130 <<
" Received ROV (" << auv->ctr_id
131 <<
") updated position X: "
132 << auv->rov_position->getX()
133 <<
" Y: " << auv->rov_position->getY()
134 <<
" Z: " << auv->rov_position->getZ()
135 <<
" #mine tracked = " << auv->n_mines
136 <<
" rov_status = " << auv->rov_status;
139 std::cout <<
" mine status = "
140 << auv->rov_mine[auv->n_mines - 1].state;
142 std::cout << std::endl;
149 std::cout << NOW <<
" UwMissionCoordinatorModule::recvSyncClMsg()"
150 <<
" no auv found with id (" <<
id <<
")" << std::endl;
162 return element.trk_id == id;
165 if (auv->rov_status) {
166 const auto &mine = auv->rov_mine.end() - 1;
168 if (mine->track_position->getDist(p) > 0 &&
176 auv->rov_status =
true;
184 <<
" UwMissionCoordinatorModule::recvSyncClMsg()"
185 <<
" ROV (" << auv->trk_id
186 <<
") tracked mine at position X: " << p->getX()
187 <<
" Y: " << p->getY() <<
" Z: " << p->getZ()
188 <<
" #mine tracked = " << auv->n_mines
189 <<
" rov_status = " << auv->rov_status << std::endl;
195 std::cout << NOW <<
" UwMissionCoordinatorModule::recvSyncClMsg()"
196 <<
" can't track mine at position X: " << p->getX()
197 <<
" Y: " << p->getY() <<
" Z: " << p->getZ()
207 return element.trk_id == id;
217 return PlugIn::recvSyncClMsg(m);
225 [
id](
const AUV_stats &element) { return element.ctr_id == id; });
228 const auto &mine = auv->rov_mine.end() - 1;
232 auv->rov_status =
false;
239 std::cout << NOW <<
" UwMissionCoordinatorModule::removeMine()"
240 <<
" Removed mine at position"
241 <<
" X: " << mine->track_position->getX()
242 <<
" Y: " << mine->track_position->getY()
243 <<
" Z: " << mine->track_position->getZ()
247 std::cout << NOW <<
" UwMissionCoordinatorModule::removeMine()"
248 <<
" Cannot remove mine detected by ROV (" <<
id <<
")"
256 for (
const auto &mine : auv.rov_mine) {
257 if (mine.track_position->getDist(p) < 1e-3) {
260 <<
" UwMissionCoordinatorModule::isTracked()"
261 <<
" Mine at position X: " << p->getX()
262 <<
" Y: " << p->getY() <<
" Z: " << p->getZ()
263 <<
" is already tracked by ROV (" << auv.trk_id
ClMessage_t CLMSG_TRACK2MC_TRACKPOS
ClMessage_t CLMSG_CTR2MC_GETPOS
ClMessage_t CLMSG_TRACK2MC_GETSTATUS
Class that manages cross layer messages that require the position of the ROV follower.
Class that manages cross layer messages that require the new destination of the ROV follower.
void setRovDestination(Position *destination)
Sets the ROV follower destination.
Class that manages cross layer messages that require the status of the ROV follower.
void setRovStatus(bool detect)
Sets the rov follower status.
Class that manages cross layer messages that require the track position of the ROV follower.
Class that manages cross layer messages that require the status of a mine tracked from a rov follower...
Class that represents the binding with the tcl configuration script.
UwMissionCoordinatorModuleClass()
Constructor of the class.
TclObject * create(int, const char *const *)
Creates the TCL object needed for the tcl language interpretation.
UwMissionCoordinatorModule class is used to manage AUV followers and to collect statistics about them...
virtual int command(int argc, const char *const *argv) override
TCL command interpreter.
virtual int recvSyncClMsg(ClMessage *m) override
Recv syncronous cross layer messages to require an operation from another module.
void removeMine(int id)
Send a signal to the AUV follower to inform it, that the mine it is detecting is removed.
std::vector< AUV_stats > auv_follower
ROV followers info.
UwMissionCoordinatorModule()
Default Constructor of UwMissionCoordinatorModule class.
bool isTracked(Position *p) const
Check if the mine at received position is already tracked.
AUV_stats describes statistics about the AUV follower.
@ MINE_DETECTED
Mine found and started the removing process.
@ MINE_REMOVED
Mine removed.
@ MINE_TRACKED
Mine tracked.
UwMissionCoordinatorModuleClass class_module_uwMC
Provides the definition of the class UWSMPosition.