53 : TclClass(
"Module/UW/ROV/CTR")
72 , adaptiveRTO_parameter(0.5)
83 cerr << NOW <<
"Invalide adaptive RTO parameter < 0, set to 0.5 "
84 <<
"by default " << std::endl;
92 Tcl &tcl = Tcl::instance();
94 if (strcasecmp(argv[1],
"getROVMonheadersize") == 0) {
98 }
else if (strcasecmp(argv[1],
"getROVctrheadersize") == 0) {
102 }
else if (strcasecmp(argv[1],
"getX") == 0) {
103 tcl.resultf(
"%f",
posit->getX());
106 }
else if (strcasecmp(argv[1],
"getY") == 0) {
107 tcl.resultf(
"%f",
posit->getY());
110 }
else if (strcasecmp(argv[1],
"getZ") == 0) {
111 tcl.resultf(
"%f",
posit->getZ());
115 }
else if (argc == 3) {
116 if (strcasecmp(argv[1],
"setPosition") == 0) {
117 Position *p =
dynamic_cast<Position *
>(tcl.lookup(argv[2]));
126 }
else if (strcasecmp(argv[1],
"setSpeed") == 0) {
127 std::stringstream speed_ss(argv[2]);
128 if (speed_ss >>
speed)
132 }
else if (strcasecmp(argv[1],
"setAdaptiveRTOparameter") == 0) {
133 std::stringstream artop_ss(argv[2]);
139 }
else if (argc == 5) {
140 if (strcasecmp(argv[1],
"sendPosition") == 0) {
141 newX = std::atof(argv[2]);
142 newY = std::atof(argv[3]);
143 newZ = std::atof(argv[4]);
148 tcl.resultf(
"%s %f %f %f",
"Position set to ",
newX,
newY,
newZ);
152 }
else if (argc == 6) {
153 if (strcasecmp(argv[1],
"sendPosition") == 0) {
154 newX = std::atof(argv[2]);
155 newY = std::atof(argv[3]);
156 newZ = std::atof(argv[4]);
157 speed = std::atof(argv[5]);
162 tcl.resultf(
"%s %f %f %f",
"Position set to ",
newX,
newY,
newZ);
163 tcl.resultf(
"%s %f",
"Speed set to ",
speed);
181 std::cout << NOW <<
" UwROVCtrModule::RTO set to " <<
period_
197 if (this->
pkt ==
nullptr) {
217 std::cout << NOW <<
" UwROVCtrModule::initPkt(Packet *p) "
218 <<
"Retransmitting" << std::endl;
233 std::cout << NOW <<
" UwROVCtrModule::initPkt(Packet *p) setting new"
234 <<
" ROV way-point: X = " << uwROVh->
x()
235 <<
", Y = " << uwROVh->
y() <<
", Z = " << uwROVh->
z()
254 if (monitoring->
ack() ==
sn + 1) {
260 std::cout << NOW <<
" UwROVCtrModule::recv(Packet *p) control ACK "
261 <<
"received " << monitoring->
ack() << std::endl;
262 else if ((monitoring->
ack()) < 0 &&
debug_)
263 std::cout << NOW <<
" UwROVCtrModule::recv(Packet *p) control error "
264 <<
"received" << std::endl;
266 std::cout << NOW <<
" UwROVCtrModule::recv(Packet *p) ROV monitoring "
267 <<
"position: X = " <<
x_rov <<
", Y = " <<
y_rov
268 <<
", Z = " <<
z_rov << std::endl;
UwCbrModule class is used to manage UWCBR packets and to collect statistics about them.
virtual void initPkt(Packet *p)
Initializes a data packet passed as argument with the default values.
virtual int command(int argc, const char *const *argv) override
TCL command interpreter.
int debug_
Flag to enable several levels of debug.
virtual void recv(Packet *) override
Performs the reception of packets from upper and lower layers.
UwSendTimer sendTmr_
Timer which schedules packet transmissions.
double sumrtt
Sum of RTT samples.
double period_
Period between two consecutive packet transmissions.
virtual void sendPkt()
Allocates, initialize and sends a packet with the default priority flag set from tcl.
int rttsamples
Number of RTT samples.
Class that represents the binding with the tcl configuration script.
UwROVCtrModuleClass()
Constructor of the class.
TclObject * create(int, const char *const *)
Creates the TCL object needed for the tcl language interpretation.
UwROVCtrModule class is used to manage UWROVCtr packets and to collect statistics about them.
float y_rov
Y of the last ROV position monitored.
int adaptiveRTO
Sequence number of the last control packet sent.
float x_rov
X of the last ROV position monitored.
Position * posit
Controller position.
virtual int command(int argc, const char *const *argv) override
TCL command interpreter.
float newY
Y of the new position sent to the ROV.
virtual void transmit() override
Creates and transmits a packet.
virtual void initPkt(Packet *p) override
Initializes a control data packet passed as argument with the default values.
double adaptiveRTO_parameter
Parameter for the adaptive RTO.
float newZ
Z of the new position sent to the ROV.
virtual void recv(Packet *) override
Performs the reception of packets from upper and lower layers.
static int getROVCTRHeaderSize()
Returns the size in byte of a hdr_uwROV_ctr packet header.
float z_rov
Z of the last ROV position monitored.
float newX
X of the new position sent to the ROV.
void reset_retx()
Reset retransmissions.
virtual void start() override
Start the controller.
static int getROVMonHeaderSize()
Returns the size in byte of a hdr_uwROV_monitoring packet header.
UwROVCtrModule()
Constructor of UwROVCtrModule class.
float speed
Moving speed sent to the ROV.
hdr_uwROV_ctr describes UWROV_ctr packets for controlling the ROV.
hdr_uwROV_monitoring describes UWROV_monitoring packets sent by the ROV to the base station for monit...
UwROVCtrModuleClass class_module_uwROV_ctr
Provides the definition of the class UWROV.
#define HDR_UWROV_MONITORING(p)