DESERT 3.6.0
Loading...
Searching...
No Matches
uwrovctr-module.h
Go to the documentation of this file.
1//
2// Copyright (c) 2017 Regents of the SIGNET lab, University of Padova.
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions
7// are met:
8// 1. Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10// 2. Redistributions in binary form must reproduce the above copyright
11// notice, this list of conditions and the following disclaimer in the
12// documentation and/or other materials provided with the distribution.
13// 3. Neither the name of the University of Padova (SIGNET lab) nor the
14// names of its contributors may be used to endorse or promote products
15// derived from this software without specific prior written permission.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28//
47#ifndef UWROV_CTR_MODULE_H
48#define UWROV_CTR_MODULE_H
49
50#include <node-core.h>
51#include <uwcbr-module.h>
52#include "uwrov-packet.h"
53
54#define UWROV_DROP_REASON_UNKNOWN_TYPE "UKT"
55#define UWROV_DROP_REASON_OUT_OF_SEQUENCE "OOS"
56#define UWROV_DROP_REASON_DUPLICATED_PACKET "DPK"
57#define HDR_UWROV_MONITORING(p) (hdr_uwROV_monitoring::access(p))
58#define HDR_UWROV_CTR(p) (hdr_uwROV_ctr::access(p))
59
60class UwROVCtrModule;
61
67{
68public:
76};
77
83{
84public:
89
93 virtual ~UwROVCtrModule() = default;
94
105 virtual int command(int argc, const char *const *argv) override;
106
114 virtual void initPkt(Packet *p) override;
115
119 void
121 {
122 pkt = nullptr;
123 sendTmr_.force_cancel();
124 }
125
131 virtual void recv(Packet *) override;
132
139 virtual void recv(Packet *p, Handler *h) override;
140
146 virtual void transmit() override;
147
151 virtual void start() override;
152
158 static int
160 {
161 return sizeof(hdr_uwROV_monitoring);
162 }
163
169 static int
171 {
172 return sizeof(hdr_uwROV_ctr);
173 }
174
175protected:
176 int sn;
179 float x_rov;
180 float y_rov;
181 float z_rov;
182 float newX;
183 float newY;
184 float newZ;
185 float speed;
186 Position* posit;
187 Packet *pkt;
188};
189
190#endif // UWROVCtr_MODULE_H
UwCbrModule class is used to manage UWCBR packets and to collect statistics about them.
UwSendTimer sendTmr_
Timer which schedules packet transmissions.
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.
virtual ~UwROVCtrModule()=default
Destructor of UwROVCtrModule class.
UwROVCtrModule()
Constructor of UwROVCtrModule class.
float speed
Moving speed sent to the ROV.
UwROVCtrSendTimer class is used to handle the scheduling period of UWROV packets.
UwROVCtrSendTimer(UwROVCtrModule *m)
Conscructor of UwSendTimer class.
UwSendTimer class is used to handle the scheduling period of UWCBR packets.
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...
Provides the UWCBR packets header description and the definition of the class UWCBR.
Provides both UWROV monitoring and control packets header description.