DESERT 3.5.1
Loading...
Searching...
No Matches
uwsmposition.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//
29
49#ifndef _UWSMPOSITION_
50#define _UWSMPOSITION_
51
52#include <node-core.h>
53
54#define sgn(x) (((x) == 0.0) ? 0.0 : ((x) / fabs(x)))
55#define pi (4 * atan(1.0))
56
57class UWSMPosition : public Position
58{
59public:
67 virtual ~UWSMPosition();
73 virtual double getX();
79 virtual double getY();
80
86 virtual double getZ();
87
91 virtual double getXdest() const;
92
96 virtual double getYdest() const;
97
101 virtual double getZdest() const;
102
106 double getSpeed() const;
107
129 virtual int command(int argc, const char *const *argv);
130 virtual void setdest(
131 double x_dest, double y_dest, double z_dest, double spead);
132 virtual void setdest(double x_dest, double y_dest, double z_dest);
133 virtual bool isDestReached() const;
134 virtual void setX(double x);
135 virtual void setY(double y);
136 virtual void setZ(double z);
137
138private:
142 virtual void update(double now);
143
144 double trgTime_;
147 double Xdest_;
148 double Ydest_;
149 double Zdest_;
150 double Xsorg_;
152 double Ysorg_;
154 double Zsorg_;
156 double speed_;
157
159};
160
161#endif
virtual void setY(double y)
double lastUpdateTime_
time in which the TCL command setdest is invoked
virtual ~UWSMPosition()
Destructor.
int debug_
speed of the node
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.
virtual bool isDestReached() const
virtual int command(int argc, const char *const *argv)
TCL command interpreter setdest <integer value>integer value>integer value>: set the movement pattern...
virtual void setZ(double z)
UWSMPosition()
Constructor.
virtual void update(double now)
Method that updates both the position coordinates.
double getSpeed() const
Method that return the actual speed.
virtual double getZdest() const
Method that return the z cooridnate of the destination point.
virtual double getYdest() const
Method that return the y cooridnate of the destination point.
double speed_
position on the z-axis of the starting point (when the TCL command setdest is invoked)
virtual double getZ()
Method that return the current projection of the node on the z-axis.
double Zdest_
position on the y-axis of the destination point
virtual void setX(double x)
virtual double getXdest() const
Method that return the x cooridnate of the destination point.
double Xdest_
time last updated of the coordinates was computed
double Ydest_
position on the x-axis of the destination point
double Xsorg_
position on the z-axis of the destination point
double Zsorg_
position on the y-axis of the starting point (when the TCL command setdest is invoked)
virtual void setdest(double x_dest, double y_dest, double z_dest, double spead)
double Ysorg_
position on the x-axis of the starting point (when the TCL command setdest is invoked)