MIRA
UnicycleBasedRobotModel.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * and
5  * Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
6  * All rights reserved.
7  *
8  * Contact: info@mira-project.org
9  *
10  * Commercial Usage:
11  * Licensees holding valid commercial licenses may use this file in
12  * accordance with the commercial license agreement provided with the
13  * software or, alternatively, in accordance with the terms contained in
14  * a written agreement between you and MLAB or NICR.
15  *
16  * GNU General Public License Usage:
17  * Alternatively, this file may be used under the terms of the GNU
18  * General Public License version 3.0 as published by the Free Software
19  * Foundation and appearing in the file LICENSE.GPL3 included in the
20  * packaging of this file. Please review the following information to
21  * ensure the GNU General Public License version 3.0 requirements will be
22  * met: http://www.gnu.org/copyleft/gpl.html.
23  * Alternatively you may (at your option) use any later version of the GNU
24  * General Public License if such license has been publicly approved by
25  * MLAB and NICR (or its successors, if any).
26  *
27  * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
28  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
29  * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
30  * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
34  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
35  * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
36  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
37  */
38 
47 #ifndef _MIRA_UNICYCLEBASEDROBOTMODEL_H_
48 #define _MIRA_UNICYCLEBASEDROBOTMODEL_H_
49 
51 
52 #include <robot/RobotModel.h>
53 
54 namespace mira { namespace robot {
55 
57 
59 {
61 
62 public:
63 
64  // keep using Angle for serialization compatibility
65  template<typename Reflector>
66  void reflectDegrees(Reflector& r,
67  const char* name, float& member, const char* comment) {
68  if (Reflector::isReadOnly::value) {
69  Anglef a(member);
70  r.property(name, a, comment, PropertyHint(), REFLECT_CTRLFLAG_TEMP_TRACKING);
71  } else {
72  Anglef a;
73  r.property(name, a, comment, PropertyHint(), REFLECT_CTRLFLAG_TEMP_TRACKING);
74  member = a.rad();
75  }
76  }
77 
79  const char* name, float& member, const char* comment) {
80  r.property(name,
82  comment, PropertyHints::minimum(0.f));
83  }
84 
85  template<typename Reflector>
86  void reflect(Reflector& r)
87  {
88  MIRA_REFLECT_BASE(r, RigidModel);
89  r.property("MaxBackwardVelocity", maxBackwardVelocity,
90  "The maximum velocity for driving backward (both wheels) [m/s]");
91  r.property("MaxForwardVelocity", maxForwardVelocity,
92  "The maximum velocity for driving forward (both wheels) [m/s]");
93  reflectDegrees(r, "MaxRotVelocity", maxRotVelocity,
94  "The maximum velocity for rotating [deg/s]");
95  r.property("TransEpsilonVelocity", transEpsilonVelocity,
96  "The min. translational speed that the robot platform can do [m/s]. "
97  "Lower velocities result in standing still.");
98  reflectDegrees(r, "RotEpsilonVelocity", rotEpsilonVelocity,
99  "The min. rotational speed that the robot platform can do [deg/s]. "
100  "Lower velocities result in standing still.");
101 
102  r.property("MaxTransAcceleration", maxTransAcceleration,
103  "Max. acceleration [m/s^2]");
104  r.property("MaxTransDeceleration", maxTransDeceleration,
105  "Max. deceleration [m/s^2]");
106  reflectDegrees(r, "MaxRotAcceleration", maxRotAcceleration,
107  "Max. acceleration [deg/s^2]");
108  reflectDegrees(r, "MaxRotDeceleration", maxRotDeceleration,
109  "Max. deceleration [deg/s^2]");
110  r.property("MaxEmergencyDeceleration", maxEmergencyDeceleration,
111  "Max. deceleration in case of an emergency [m/s^2]. Must be greater than zero.");
112  }
113 
114  float getMaxTransVelocity() const;
115 
123  virtual PoseVelocityTrajectory generateTrajectory(Velocity2 v, const Velocity2& targetV,
124  float lookAheadTime, int samples);
125 
129 
132 
135 
142 
149 
154 };
155 
157 typedef boost::shared_ptr<UnicycleBasedRobotModel> UnicycleBasedRobotModelPtr;
158 
160 
162 {
164 }
165 
167 
168 }} // namespace
169 
170 #endif
REFLECT_CTRLFLAG_TEMP_TRACKING
float getMaxTransVelocity() const
Definition: UnicycleBasedRobotModel.h:161
std::vector< PoseVelocityTrajectorySample, Eigen::aligned_allocator< PoseVelocityTrajectorySample > > PoseVelocityTrajectory
A sampled trajectory, a collection of trajectory samples, each containing a pose and velocity at a de...
Definition: Trajectory.h:118
float rotEpsilonVelocity
Definition: UnicycleBasedRobotModel.h:141
Getter< T > rad2degGetter(const T &cref)
float maxEmergencyDeceleration
Max. deceleration in case of an emergency. Must be greater than zero.
Definition: UnicycleBasedRobotModel.h:148
void reflectDegrees(Reflector &r, const char *name, float &member, const char *comment)
Definition: UnicycleBasedRobotModel.h:66
float maxRotAcceleration
Max. acceleration.
Definition: UnicycleBasedRobotModel.h:151
#define MIRA_REFLECT_BASE(reflector, BaseClass)
Definition: UnicycleBasedRobotModel.h:58
float maxBackwardVelocity
The maximum velocity for driving backward (both wheels) [m/s].
Definition: UnicycleBasedRobotModel.h:128
float maxTransDeceleration
Max. deceleration. Must be greater than zero.
Definition: UnicycleBasedRobotModel.h:146
boost::shared_ptr< UnicycleBasedRobotModel > UnicycleBasedRobotModelPtr
Typedef for UnicycleBasedRobotModel pointer.
Definition: UnicycleBasedRobotModel.h:157
#define MIRA_ABSTRACT_OBJECT(classIdentifier)
float maxRotDeceleration
Max. deceleration. Must be greater than zero.
Definition: UnicycleBasedRobotModel.h:153
float maxForwardVelocity
The maximum velocity for driving forward (both wheels) [m/s].
Definition: UnicycleBasedRobotModel.h:131
Setter< T > deg2radSetter(T &ref)
Duration abs(const Duration &duration)
float maxTransAcceleration
Max. acceleration.
Definition: UnicycleBasedRobotModel.h:144
float maxRotVelocity
The maximum velocity for rotating [deg/s].
Definition: UnicycleBasedRobotModel.h:134
float transEpsilonVelocity
the min.
Definition: UnicycleBasedRobotModel.h:140
constexpr Deg2RadNonNegativeType Deg2RadNonNegative
void reflect(Reflector &r)
Definition: UnicycleBasedRobotModel.h:86
PropertyHint minimum(const T &min)
T rad() const
void reflectDegrees(PropertySerializer &r, const char *name, float &member, const char *comment)
Definition: UnicycleBasedRobotModel.h:78
Base class for all robot models, such as DifferentialRobotModel.
Definition: RobotModel.h:68
void property(const char *name, T &member, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
#define MIRA_ROBOT_DATATYPES_EXPORT
Definition: RobotDataTypesExports.h:61
Base class for robot models.