base
JointLimitRange.hpp
Go to the documentation of this file.
1 #ifndef BASE_JOINT_LIMIT_RANGE_HPP
2 #define BASE_JOINT_LIMIT_RANGE_HPP
3 
4 #include <base/JointState.hpp>
5 
6 namespace base
7 {
8 
10 {
13 
14  struct OutOfBounds : public std::runtime_error
15  {
16  static std::string errorString( std::string name, double min, double max, double value );
17 
18  std::string name;
19  double min, max, value;
21  : std::runtime_error( std::string() ), min(0), max(0), value(0) {}
22  OutOfBounds( std::string name, double min, double max, double value )
23  : std::runtime_error( errorString( name, min, max, value ) )
24  , name( name )
25  , min( min ), max( max ), value( value )
26  {
27  }
28  ~OutOfBounds() throw() {}
29  };
30 
36  void validate( const JointState &state ) const;
37 
43  bool isValid( const JointState &state ) const;
44 
48  static JointLimitRange Position(double min, double max);
49 
53  static JointLimitRange Speed(double min, double max);
54 
58  static JointLimitRange Effort(double min, double max);
59 
63  static JointLimitRange Raw(double min, double max);
64 
68  static JointLimitRange Acceleration(double min, double max);
69 
70 
71 private:
73  std::pair<bool, OutOfBounds> verifyValidity( const JointState& state ) const;
74 
75 };
76 
77 }
78 
79 #endif
double max
Definition: JointLimitRange.hpp:19
OutOfBounds()
Definition: JointLimitRange.hpp:20
OutOfBounds(std::string name, double min, double max, double value)
Definition: JointLimitRange.hpp:22
static JointLimitRange Position(double min, double max)
Definition: JointLimitRange.cpp:29
static std::string errorString(std::string name, double min, double max, double value)
Definition: JointLimitRange.cpp:8
~OutOfBounds()
Definition: JointLimitRange.hpp:28
std::string name
Definition: JointLimitRange.hpp:18
static JointLimitRange Raw(double min, double max)
Definition: JointLimitRange.cpp:55
JointState max
Definition: JointLimitRange.hpp:12
Definition: JointLimitRange.hpp:9
static JointLimitRange Acceleration(double min, double max)
Definition: JointLimitRange.cpp:63
bool isValid(const JointState &state) const
Definition: JointLimitRange.cpp:23
JointState min
Definition: JointLimitRange.hpp:11
Definition: LinearAngular6DCommand.hpp:8
Definition: JointState.hpp:19
void validate(const JointState &state) const
Definition: JointLimitRange.cpp:16
double value
Definition: JointLimitRange.hpp:19
Definition: JointLimitRange.hpp:14
double min
Definition: JointLimitRange.hpp:19
static JointLimitRange Effort(double min, double max)
Definition: JointLimitRange.cpp:47
static JointLimitRange Speed(double min, double max)
Definition: JointLimitRange.cpp:38