39#include "mphy_pktheader.h"
44#define HDR_UWTRACK(p) (hdr_uwTracker::access(p))
65 TclObject*
create(
int,
const char*
const*) {
72 , track_position(nullptr)
74 , max_tracking_distance(std::numeric_limits<int>::max())
75 , send_only_active_trace(0)
87 , max_tracking_distance(std::numeric_limits<int>::max())
88 , send_only_active_trace(0)
89 , track_my_position(0)
102 Tcl& tcl = Tcl::instance();
104 if (strcasecmp(argv[1],
"setTrack") == 0) {
107 tcl.resultf(
"%s",
"position Setted\n");
110 if (strcasecmp(argv[1],
"setMaxTrackDistance") == 0) {
112 tcl.resultf(
"%s",
"max_tracking_distance Setted\n");
115 if (strcasecmp(argv[1],
"setTrackMyPosition") == 0) {
117 tcl.resultf(
"%s",
"max_tracking_distance Setted\n");
127 Position track_tmp_pos;
142 std::cout << NOW <<
" UwTrackerModule::initPkt(Packet *p) Track current "
143 <<
"position: X = " << uw_track_h->
x() <<
144 ", Y = " << uw_track_h->
y()
145 <<
", Z = " << uw_track_h->
z()
146 <<
", speed = " << uw_track_h->
speed() << std::endl;
156 hdr_MPhy *ph = HDR_MPHY(p);
159 hdr_cmn *ch = hdr_cmn::access(p);
162 tracefile << NOW <<
" " << ch->timestamp() <<
" " << uwcbrh->
sn()
163 <<
" " << (int) uwiph->
saddr() <<
" " << (int) uwiph->
daddr()
164 <<
" " << ch->size();
165 Position track_tmp_pos;
166 track_tmp_pos.setX(uw_track_h->
x());
167 track_tmp_pos.setY(uw_track_h->
y());
168 track_tmp_pos.setZ(uw_track_h->
z());
171 <<
" " << uw_track_h->
x() <<
" "
172 << uw_track_h->
y() <<
" " << uw_track_h->
z() <<
" "
173 << uw_track_h->
speed();
175 tracefile <<
" NO TRACKS IN RANGE, distance = "
176 << track_tmp_pos.getDist(ph->srcPosition) <<
" max distance = "
215 module->updateTrackMeasure();
virtual double getY()
Method that return the current projection of the node on the y-axis.
virtual double getX()
Method that return the current projection of the node on the x-axis.
double getSpeed() const
Method that return the actual speed.
virtual double getZ()
Method that return the current projection of the node on the z-axis.
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 void stop()
Stop to send packets.
int debug_
Flag to enable several levels of debug.
int tracefile_enabler_
True if enable tracefile of received packets, default disabled.
virtual void start()
Start to send packets.
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
virtual void sendPkt()
Allocates, initialize and sends a packet with the default priority flag set from tcl.
Class that represents the binding with the tcl configuration script.
UwTrackerModuleClass()
Constructor of the class.
TclObject * create(int, const char *const *)
Creates the TCL object needed for the tcl language interpretation.
UwTrackerModule class is used to track mobile nodes via sonar and share tracking information via pack...
virtual void stop()
Stop to send packets.
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
virtual ~UwTrackerModule()
Destructor of UwTrackerModule class.
UwUpdateTrackMeasure measure_timer
timer to schedule tracking measurements
double tracking_period
period between tracking measurements
void sendPkt()
Allocates, initialize and sends a packet with the default priority flag set from tcl.
hdr_uwTracker track_measure
Track position.
virtual void start()
Start to send packets.
int send_only_active_trace
send only active trace
int track_my_position
track also my position
virtual void initPkt(Packet *p)
Initializes a monitoring data packet passed as argument with the default values.
UwTrackerModule()
Default Constructor of UwTrackerModule class.
UWSMPosition * track_position
Track position.
double max_tracking_distance
Maximum tracking distance, in [m].
void updateTrackMeasure()
Update the track measure.
virtual void printReceivedPacket(Packet *p)
Print to tracefile details about a received packet.
virtual void expire(Event *e)
hdr_uwROV_ctr describes UWROV_ctr packets for controlling the ROV.
float & timestamp()
Reference to the timestamp variable.
float & speed()
Reference to the speed variable.
float & x()
Reference to the x variable.
float & z()
Reference to the z variable.
float & y()
Reference to the y variable.
static int offset_
Required by the PacketHeaderManager.
hdr_uwcbr describes UWCBR packets.
uint16_t & sn()
Reference to the sn_ variable.
hdr_uwip describes UWIP packets.
uint8_t & daddr()
Reference to the daddr_ variable.
uint8_t & saddr()
Reference to the saddr_ variable.
static hdr_uwip * access(const Packet *p)
Provides the definition of the class UWSMPosition.
UwTrackerModuleClass class_module_uwTrack
Provides the definition of the class UWROV.