Added Juergen's original changes to KDL
This commit is contained in:
parent
1908e852f0
commit
9304f7a78a
|
@ -23,6 +23,15 @@
|
||||||
|
|
||||||
#include "chainiksolverpos_nr_jl.hpp"
|
#include "chainiksolverpos_nr_jl.hpp"
|
||||||
|
|
||||||
|
// FreeCAD change
|
||||||
|
#ifndef M_PI
|
||||||
|
#define M_PI 3.14159265358979323846 /* pi */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef M_PI_2
|
||||||
|
#define M_PI_2 1.57079632679489661923 /* pi/2 */
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace KDL
|
namespace KDL
|
||||||
{
|
{
|
||||||
ChainIkSolverPos_NR_JL::ChainIkSolverPos_NR_JL(const Chain& _chain, const JntArray& _q_min, const JntArray& _q_max, ChainFkSolverPos& _fksolver,ChainIkSolverVel& _iksolver,
|
ChainIkSolverPos_NR_JL::ChainIkSolverPos_NR_JL(const Chain& _chain, const JntArray& _q_min, const JntArray& _q_max, ChainFkSolverPos& _fksolver,ChainIkSolverVel& _iksolver,
|
||||||
|
@ -50,13 +59,15 @@ namespace KDL
|
||||||
|
|
||||||
for(unsigned int j=0; j<q_min.rows(); j++) {
|
for(unsigned int j=0; j<q_min.rows(); j++) {
|
||||||
if(q_out(j) < q_min(j))
|
if(q_out(j) < q_min(j))
|
||||||
q_out(j) = q_min(j);
|
//q_out(j) = q_min(j); // FreeCAD change
|
||||||
|
q_out(j) = q_out(j) + M_PI *2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for(unsigned int j=0; j<q_max.rows(); j++) {
|
for(unsigned int j=0; j<q_max.rows(); j++) {
|
||||||
if(q_out(j) > q_max(j))
|
if(q_out(j) > q_max(j))
|
||||||
q_out(j) = q_max(j);
|
//q_out(j) = q_max(j); // FreeCAD change
|
||||||
|
q_out(j) = q_out(j) - M_PI *2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,12 @@ namespace KDL {
|
||||||
class Trajectory
|
class Trajectory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual Path* GetPath() = 0;
|
||||||
|
// The underlying Path - FreeCAD change
|
||||||
|
|
||||||
|
virtual VelocityProfile* GetProfile() = 0;
|
||||||
|
// The velocity profile - FreeCAD change
|
||||||
|
|
||||||
virtual double Duration() const = 0;
|
virtual double Duration() const = 0;
|
||||||
// The duration of the trajectory
|
// The duration of the trajectory
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace KDL {
|
||||||
|
|
||||||
Trajectory_Composite::Trajectory_Composite():duration(0.0)
|
Trajectory_Composite::Trajectory_Composite():duration(0.0)
|
||||||
{
|
{
|
||||||
|
path = new Path_Composite(); // FreeCAD change
|
||||||
}
|
}
|
||||||
|
|
||||||
double Trajectory_Composite::Duration() const{
|
double Trajectory_Composite::Duration() const{
|
||||||
|
@ -92,6 +93,7 @@ namespace KDL {
|
||||||
vt.insert(vt.end(),elem);
|
vt.insert(vt.end(),elem);
|
||||||
duration += elem->Duration();
|
duration += elem->Duration();
|
||||||
vd.insert(vd.end(),duration);
|
vd.insert(vd.end(),duration);
|
||||||
|
path->Add(elem->GetPath(),false); // FreeCAD change
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trajectory_Composite::Destroy() {
|
void Trajectory_Composite::Destroy() {
|
||||||
|
@ -101,6 +103,8 @@ namespace KDL {
|
||||||
}
|
}
|
||||||
vt.erase(vt.begin(),vt.end());
|
vt.erase(vt.begin(),vt.end());
|
||||||
vd.erase(vd.begin(),vd.end());
|
vd.erase(vd.begin(),vd.end());
|
||||||
|
|
||||||
|
delete path; // FreeCAD change
|
||||||
}
|
}
|
||||||
|
|
||||||
Trajectory_Composite::~Trajectory_Composite() {
|
Trajectory_Composite::~Trajectory_Composite() {
|
||||||
|
@ -125,6 +129,16 @@ namespace KDL {
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FreeCAD change
|
||||||
|
Path* Trajectory_Composite::GetPath()
|
||||||
|
{
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
VelocityProfile* Trajectory_Composite::GetProfile()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ class Trajectory_Composite: public Trajectory
|
||||||
VectorDouble vd; // contains end time for each Trajectory
|
VectorDouble vd; // contains end time for each Trajectory
|
||||||
double duration; // total duration of the composed
|
double duration; // total duration of the composed
|
||||||
// Trajectory
|
// Trajectory
|
||||||
|
Path_Composite* path; // FreeCAD change
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Trajectory_Composite();
|
Trajectory_Composite();
|
||||||
|
@ -53,6 +54,11 @@ class Trajectory_Composite: public Trajectory
|
||||||
virtual void Destroy();
|
virtual void Destroy();
|
||||||
virtual void Write(std::ostream& os) const;
|
virtual void Write(std::ostream& os) const;
|
||||||
virtual Trajectory* Clone() const;
|
virtual Trajectory* Clone() const;
|
||||||
|
virtual Path* GetPath(); // FreeCAD change
|
||||||
|
virtual VelocityProfile* GetProfile(); // FreeCAD change
|
||||||
|
|
||||||
|
// access the single members
|
||||||
|
Trajectory *Get(unsigned int n){return vt[n];} // FreeCAD change
|
||||||
|
|
||||||
virtual ~Trajectory_Composite();
|
virtual ~Trajectory_Composite();
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,9 +29,22 @@ namespace KDL {
|
||||||
{
|
{
|
||||||
double duration;
|
double duration;
|
||||||
Frame pos;
|
Frame pos;
|
||||||
|
VelocityProfile* prof; // FreeCAD change
|
||||||
|
Path* path; // FreeCAD change
|
||||||
public:
|
public:
|
||||||
Trajectory_Stationary(double _duration,const Frame& _pos):
|
Trajectory_Stationary(double _duration,const Frame& _pos):
|
||||||
duration(_duration),pos(_pos) {}
|
duration(_duration),pos(_pos) {}
|
||||||
|
|
||||||
|
// FreeCAD change
|
||||||
|
virtual Path* GetPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FreeCAD change
|
||||||
|
virtual VelocityProfile* GetProfile() {
|
||||||
|
return prof;
|
||||||
|
}
|
||||||
|
|
||||||
virtual double Duration() const {
|
virtual double Duration() const {
|
||||||
return duration;
|
return duration;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +62,7 @@ namespace KDL {
|
||||||
virtual Trajectory* Clone() const {
|
virtual Trajectory* Clone() const {
|
||||||
return new Trajectory_Stationary(duration,pos);
|
return new Trajectory_Stationary(duration,pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~Trajectory_Stationary() {}
|
virtual ~Trajectory_Stationary() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ public:
|
||||||
template <>
|
template <>
|
||||||
class RallNd<2> : public Rall2d<double> {
|
class RallNd<2> : public Rall2d<double> {
|
||||||
public:
|
public:
|
||||||
RallNd() {}* (dwz. met evenveel numerieke operaties als een
|
RallNd() {} /* (dwz. met evenveel numerieke operaties als een */
|
||||||
RallNd(const Rall2d<double>& arg) :
|
RallNd(const Rall2d<double>& arg) :
|
||||||
Rall2d<double>(arg) {}
|
Rall2d<double>(arg) {}
|
||||||
RallNd(double value,double d[]) {
|
RallNd(double value,double d[]) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user