21 m_chiKdl(6),m_jac(6),m_cache(NULL),
22 m_distCCh(-1),m_distCTs(0)
36 m_maxerror = armlength/2.0;
39 m_yddot = m_nextyddot = 0.0;
41 memset(&m_data, 0,
sizeof(m_data));
46 m_values.alpha = m_alpha;
47 m_values.feedback = m_K;
48 m_values.tolerance = m_tolerance;
49 m_values.values = &m_data;
58bool Distance::computeChi(
Frame& pose)
60 double dist, alpha,
beta, gamma;
128void Distance::pushDist(
CacheTS timestamp)
130 if (m_distCCh >= 0) {
134 *item++ = m_tolerance;
140 m_distCTs = timestamp;
144bool Distance::popDist(
CacheTS timestamp)
146 if (m_distCCh >= 0) {
147 double *item = (
double*)m_cache->getPreviousCacheItem(
this, m_distCCh, ×tamp);
148 if (item && timestamp != m_distCTs) {
149 m_values.feedback = m_K = *item++;
150 m_values.tolerance = m_tolerance = *item++;
153 m_values.alpha = m_alpha = *item++;
155 m_distCTs = timestamp;
159 return (item) ?
true :
false;
181 m_yddot = m_nextyddot;
189 for(
unsigned int i=0;
i<6;
i++)
193 m_jacsolver->JntToJac(m_chiKdl,m_jac);
195 for(
unsigned int i=0;
i<6;
i++)
196 for(
unsigned int j=0;j<6;j++)
206 while (_nvalues > 0) {
209 m_alpha = _values->
alpha;
228 _data->
yd = m_yd+_data->
yddot*timestep;
234 m_nextyd = _data->
yd;
239 m_yddot = (_data->
yd-m_yd)/timestep;
243 m_yddot = m_nextyddot;
253 m_yd = _data->
yd - _data->
yddot*timestep;
256 m_nextyd = _data->
yd;
257 m_nextyddot = _data->
yddot;
259 m_yddot = (_data->
yd-m_yd)/timestep;
262 m_yddot = m_nextyddot;
281 *(
double*)&m_data.y =
m_chi(2);
282 *(
double*)&m_data.ydot =
m_ydot(0);
284 m_data.yddot = m_yddot;
294 bool cacheAvail =
true;
301 *(
double*)&m_data.y =
m_chi(2);
302 *(
double*)&m_data.ydot =
m_ydot(0);
304 m_data.yddot = m_yddot;
314 m_yddot = m_nextyddot;
Class to calculate the jacobian of a general KDL::Chain, it is used by other solvers....
represents a frame transformation in 3D space (rotation + translation)
Rotation M
Orientation of the Frame.
Vector p
origine of the Frame
This class encapsulates a simple joint, that is with one parameterized degree of freedom and with sca...
represents rotations in 3 dimensional space.
Rotation Inverse() const
Gives back the inverse rotation matrix of *this.
void GetEulerZYX(double &Alfa, double &Beta, double &Gamma) const
GetEulerZYX gets the euler ZYX parameters of a rotation : First rotate around Z with alfa,...
This class encapsulates a simple segment, that is a "rigid body" (i.e., a frame and an inertia) with ...
void * addCacheItem(const void *device, int channel, CacheTS timestamp, void *data, unsigned int length)
KDL::Frame m_internalPose
KDL::Frame m_externalPose
ConstraintCallback m_constraintCallback
ConstraintSet(unsigned int nc, double accuracy, unsigned int maximum_iterations)
virtual void initCache(Cache *_cache)
virtual void updateKinematics(const Timestamp ×tamp)
Distance(double armlength=1.0, double accuracy=1e-6, unsigned int maximum_iterations=100)
virtual bool setControlParameters(struct ConstraintValues *_values, unsigned int _nvalues, double timestep)
virtual void updateControlOutput(const Timestamp ×tamp)
virtual void updateJacobian()
virtual void pushCache(const Timestamp ×tamp)
virtual bool initialise(Frame &init_pose)
virtual const ConstraintValues * getControlParameters(unsigned int *_nvalues)
static Rotation EulerZYX(double Alfa, double Beta, double Gamma)
Gives back a rotation matrix specified with EulerZYX convention : First rotate around Z with alfa,...
ccl_device_inline float beta(const float x, const float y)
ccl_device_inline float2 fabs(const float2 a)
static void error(const char *str)
INLINE S Norm(const Rall1d< T, V, S > &value)
INLINE Rall1d< T, V, S > sqrt(const Rall1d< T, V, S > &arg)
INLINE Rall1d< T, V, S > atan2(const Rall1d< T, V, S > &y, const Rall1d< T, V, S > &x)
INLINE Rall1d< T, V, S > sqr(const Rall1d< T, V, S > &arg)
const double PI
the value of pi
IMETHOD bool Equal(const VectorAcc &, const VectorAcc &, double=epsilon)
void changeRefPoint(const Jacobian &src1, const Vector &base_AB, Jacobian &dest)
double epsilon
default precision while comparing with Equal(..,..) functions. Initialized at 0.0000001.
static const unsigned int distanceCacheSize
struct ConstraintSingleValue * values