OpenWalker Project
Documentation of the ROS Packages
cartesian_velocity.h
Go to the documentation of this file.
1 
34 #ifndef OPEN_WALKER_CORE_CARTESIAN_VELOCITY_REF_H
35 #define OPEN_WALKER_CORE_CARTESIAN_VELOCITY_REF_H
36 
39 #include <geometry_msgs/Twist.h>
40 
41 namespace ow_core
42 {
54 template <typename _Scalar>
56  public Eigen::Matrix<_Scalar, 6, 1>
57 {
58 public:
59  typedef _Scalar Scalar;
60  typedef Eigen::Matrix<Scalar, 6, 1> Base;
61 
68  {
69  static const CartesianVelocity v = Base::Zero();
70  return v;
71  }
72 
73 public:
77  explicit CartesianVelocity() :
78  Base(Default())
79  {
80  }
81 
88  template <typename OtherDerived>
89  CartesianVelocity(const Eigen::EigenBase<OtherDerived>& other) :
90  Base(other.derived())
91  {
92  }
93 
97  explicit CartesianVelocity(const geometry_msgs::Twist& other)
98  {
99  operator=(other);
100  }
101 
105  using Base::operator=;
106 
111  void operator=(const geometry_msgs::Twist& Xp)
112  {
113  linear() = Xp.linear;
114  angular() = Xp.angular;
115  }
116 
122  operator geometry_msgs::Twist() const
123  {
124  geometry_msgs::Twist Xp;
125  Xp.linear = linear();
126  Xp.angular = angular();
127  return Xp;
128  }
129 
135  geometry_msgs::Twist toTwistMsg() const
136  {
137  return static_cast<geometry_msgs::Twist>(*this);
138  }
139 
144  {
145  return LinearVelocityRef<Base>(*this);
146  }
147 
152  {
153  return LinearVelocityRef<const Base>(*this);
154  }
155 
160  {
161  return AngularVelocityRef<Base>(*this,3);
162  }
163 
168  {
169  return AngularVelocityRef<const Base>(*this,3);
170  }
171 
175  std::string toString() const
176  {
177  std::ostringstream out;
178  out << this->transpose();
179  return out.str();
180  }
181 };
182 
183 } // namespace ow_core
184 
185 #endif // OPEN_WALKER_CORE_CARTESIAN_VELOCITY_REF_H
AngularVelocityRef< const Base > angular() const
const access to angular part
Definition: cartesian_velocity.h:167
CartesianVelocity()
Default Constructor.
Definition: cartesian_velocity.h:77
LinearVelocityRef< Base > linear()
access to linear part
Definition: cartesian_velocity.h:143
Definition: angular_acceleration.h:39
CartesianVelocity(const Eigen::EigenBase< OtherDerived > &other)
Copy constructor.
Definition: cartesian_velocity.h:89
LinearVelocityRef< const Base > linear() const
const access to linear part
Definition: cartesian_velocity.h:151
The LinearVelocityRef class.
Definition: linear_velocity_ref.h:52
AngularVelocityRef< Base > angular()
access to angular part
Definition: cartesian_velocity.h:159
void operator=(const geometry_msgs::Twist &Xp)
Assignment form geometry_msgs::Twist.
Definition: cartesian_velocity.h:111
CartesianVelocity(const geometry_msgs::Twist &other)
Copy constructor form geometry_msgs::Twist.
Definition: cartesian_velocity.h:97
geometry_msgs::Twist toTwistMsg() const
Conversion to geometry_msgs::Twist.
Definition: cartesian_velocity.h:135
The AngularVelocityRef class.
Definition: angular_velocity_ref.h:52
The CartesianVelocity class.
Definition: cartesian_velocity.h:55
std::string toString() const
Conversion to std::string.
Definition: cartesian_velocity.h:175
static const CartesianVelocity< Scalar > & Default()
Construct as Default.
Definition: cartesian_velocity.h:67