diff --git a/src/Mod/Robot/App/Trajectory.cpp b/src/Mod/Robot/App/Trajectory.cpp index fb799b94f7..2d857042fa 100644 --- a/src/Mod/Robot/App/Trajectory.cpp +++ b/src/Mod/Robot/App/Trajectory.cpp @@ -148,7 +148,7 @@ void Trajectory::deleteLast(unsigned int n) void Trajectory::generateTrajectory(void) { - if (vpcWaypoints.size()==0) + if (vpcWaypoints.size() == 0) return; // delete the old and create a new one @@ -164,60 +164,60 @@ void Trajectory::generateTrajectory(void) try { // handle the first waypoint special - bool first=true; + bool first = true; - for (std::vector::const_iterator it = vpcWaypoints.begin();it!=vpcWaypoints.end();++it) { + for (std::vector::const_iterator it = vpcWaypoints.begin(); it != vpcWaypoints.end(); ++it) { if (first) { Last = toFrame((*it)->EndPos); first = false; } else { // destinct the type of movement - switch((*it)->Type){ + switch ((*it)->Type) { case Waypoint::LINE: - case Waypoint::PTP:{ + case Waypoint::PTP: { KDL::Frame Next = toFrame((*it)->EndPos); // continues the movement until no continuous waypoint or the end - bool Cont = (*it)->Cont && !(it==--vpcWaypoints.end()); + bool Cont = (*it)->Cont && !(it == --vpcWaypoints.end()); // start of a continue block if (Cont && !pcRoundComp) { pcRoundComp.reset(new KDL::Path_RoundedComposite(3, 3, - new KDL::RotationalInterpolation_SingleAxis())); + new KDL::RotationalInterpolation_SingleAxis())); // the velocity of the first waypoint is used - pcVelPrf.reset(new KDL::VelocityProfile_Trap((*it)->Velocity,(*it)->Accelaration)); + pcVelPrf.reset(new KDL::VelocityProfile_Trap((*it)->Velocity, (*it)->Acceleration)); pcRoundComp->Add(Last); pcRoundComp->Add(Next); - // continue a continues block + // continue a continues block } else if (Cont && pcRoundComp) { pcRoundComp->Add(Next); // end a continuous block } - else if (Cont==false && pcRoundComp) { + else if (Cont == false && pcRoundComp) { // add the last one pcRoundComp->Add(Next); pcRoundComp->Finish(); - pcVelPrf->SetProfile(0,pcRoundComp->PathLength()); - pcTrak.reset(new KDL::Trajectory_Segment(pcRoundComp.release(),pcVelPrf.release())); + pcVelPrf->SetProfile(0, pcRoundComp->PathLength()); + pcTrak.reset(new KDL::Trajectory_Segment(pcRoundComp.release(), pcVelPrf.release())); // normal block } - else if (Cont==false && !pcRoundComp){ + else if (Cont == false && !pcRoundComp) { KDL::Path* pcPath; pcPath = new KDL::Path_Line(Last, - Next, - new KDL::RotationalInterpolation_SingleAxis(), - 1.0, - true - ); + Next, + new KDL::RotationalInterpolation_SingleAxis(), + 1.0, + true + ); - pcVelPrf.reset(new KDL::VelocityProfile_Trap((*it)->Velocity,(*it)->Accelaration)); - pcVelPrf->SetProfile(0,pcPath->PathLength()); - pcTrak.reset(new KDL::Trajectory_Segment(pcPath,pcVelPrf.release())); + pcVelPrf.reset(new KDL::VelocityProfile_Trap((*it)->Velocity, (*it)->Acceleration)); + pcVelPrf->SetProfile(0, pcPath->PathLength()); + pcTrak.reset(new KDL::Trajectory_Segment(pcPath, pcVelPrf.release())); } Last = Next; - break;} + break; } case Waypoint::WAIT: break; default: @@ -230,7 +230,7 @@ void Trajectory::generateTrajectory(void) } } } - catch (KDL::Error &e) { + catch (KDL::Error& e) { throw Base::RuntimeError(e.Description()); } } diff --git a/src/Mod/Robot/App/TrajectoryDressUpObject.cpp b/src/Mod/Robot/App/TrajectoryDressUpObject.cpp index 23cf4eca25..556befbb0f 100644 --- a/src/Mod/Robot/App/TrajectoryDressUpObject.cpp +++ b/src/Mod/Robot/App/TrajectoryDressUpObject.cpp @@ -69,7 +69,7 @@ TrajectoryDressUpObject::~TrajectoryDressUpObject() { } -App::DocumentObjectExecReturn *TrajectoryDressUpObject::execute(void) +App::DocumentObjectExecReturn* TrajectoryDressUpObject::execute(void) { Robot::Trajectory result; @@ -79,39 +79,39 @@ App::DocumentObjectExecReturn *TrajectoryDressUpObject::execute(void) if (!link->getTypeId().isDerivedFrom(Robot::TrajectoryObject::getClassTypeId())) return new App::DocumentObjectExecReturn("Linked object is not a Trajectory object"); - const std::vector &wps = static_cast(link)->Trajectory.getValue().getWaypoints(); - for (std::vector::const_iterator it= wps.begin();it!=wps.end();++it) { + const std::vector& wps = static_cast(link)->Trajectory.getValue().getWaypoints(); + for (std::vector::const_iterator it = wps.begin(); it != wps.end(); ++it) { Waypoint wpt = **it; - if(UseSpeed.getValue()) + if (UseSpeed.getValue()) wpt.Velocity = Speed.getValue(); - if(UseAcceleration.getValue()) - wpt.Accelaration = Acceleration.getValue(); - switch(ContType.getValue()){ - case 0: break; - case 1: wpt.Cont = true;break; - case 2: wpt.Cont = false;break; - default: assert(0); // must not happen! + if (UseAcceleration.getValue()) + wpt.Acceleration = Acceleration.getValue(); + switch (ContType.getValue()) { + case 0: break; + case 1: wpt.Cont = true; break; + case 2: wpt.Cont = false; break; + default: assert(0); // must not happen! } - switch(AddType.getValue()){ + switch (AddType.getValue()) { // do nothing - case 0: break; + case 0: break; // use orientation - case 1: - wpt.EndPos.setRotation(PosAdd.getValue().getRotation()); - break; + case 1: + wpt.EndPos.setRotation(PosAdd.getValue().getRotation()); + break; // add position - case 2: - wpt.EndPos.setPosition(wpt.EndPos.getPosition() + PosAdd.getValue().getPosition()); - break; + case 2: + wpt.EndPos.setPosition(wpt.EndPos.getPosition() + PosAdd.getValue().getPosition()); + break; // add orientation - case 3: - wpt.EndPos.setRotation(wpt.EndPos.getRotation() * PosAdd.getValue().getRotation()); - break; + case 3: + wpt.EndPos.setRotation(wpt.EndPos.getRotation() * PosAdd.getValue().getRotation()); + break; // add orientation & position - case 4: - wpt.EndPos= wpt.EndPos * PosAdd.getValue(); - break; - default: assert(0); // must not happen! + case 4: + wpt.EndPos = wpt.EndPos * PosAdd.getValue(); + break; + default: assert(0); // must not happen! } result.addWaypoint(wpt); @@ -119,12 +119,11 @@ App::DocumentObjectExecReturn *TrajectoryDressUpObject::execute(void) // set the resulting Trajectory to the object Trajectory.setValue(result); - + return App::DocumentObject::StdReturn; } void TrajectoryDressUpObject::onChanged(const Property* prop) { - App::GeoFeature::onChanged(prop); } diff --git a/src/Mod/Robot/App/Waypoint.cpp b/src/Mod/Robot/App/Waypoint.cpp index 452c7ec3aa..411ffde3e6 100644 --- a/src/Mod/Robot/App/Waypoint.cpp +++ b/src/Mod/Robot/App/Waypoint.cpp @@ -60,7 +60,7 @@ Waypoint::Waypoint(const char* name, const Base::Placement &endPos, WaypointType type, float velocity, - float accelaration, + float acceleration, bool cont, unsigned int tool, unsigned int base) @@ -68,7 +68,7 @@ Waypoint::Waypoint(const char* name, : Name(name) , Type(type) , Velocity(velocity) - , Accelaration(accelaration) + , Acceleration(acceleration) , Cont(cont) , Tool(tool) , Base(base) @@ -79,7 +79,7 @@ Waypoint::Waypoint(const char* name, Waypoint::Waypoint() : Type(UNDEF) , Velocity(1000.0) - , Accelaration(100.0) + , Acceleration(100.0) , Cont(false) , Tool(0) , Base(0) @@ -107,7 +107,7 @@ void Waypoint::Save (Writer &writer) const << "Q2=\"" << EndPos.getRotation()[2] << "\" " << "Q3=\"" << EndPos.getRotation()[3] << "\" " << "vel=\"" << Velocity << "\" " - << "acc=\"" << Accelaration << "\" " + << "acc=\"" << Acceleration << "\" " << "cont=\"" << int((Cont)?1:0) << "\" " << "tool=\"" << Tool << "\" " << "base=\"" << Base << "\" "; @@ -139,7 +139,7 @@ void Waypoint::Restore(XMLReader &reader) reader.getAttributeAsFloat("Q3"))); Velocity = (float) reader.getAttributeAsFloat("vel"); - Accelaration = (float) reader.getAttributeAsFloat("acc"); + Acceleration = (float) reader.getAttributeAsFloat("acc"); Cont = (reader.getAttributeAsInteger("cont") != 0)?true:false; Tool = reader.getAttributeAsInteger("tool"); Base = reader.getAttributeAsInteger("base"); diff --git a/src/Mod/Robot/App/Waypoint.h b/src/Mod/Robot/App/Waypoint.h index 33bc000645..f62ebd649f 100644 --- a/src/Mod/Robot/App/Waypoint.h +++ b/src/Mod/Robot/App/Waypoint.h @@ -50,27 +50,27 @@ public: Waypoint(); /// full constructor - Waypoint(const char* name, - const Base::Placement &endPos, - WaypointType type=Waypoint::LINE, - float velocity=2000.0, - float accelaration=100.0, - bool cont=false, - unsigned int tool=0, - unsigned int base = 0); + Waypoint(const char* name, + const Base::Placement& endPos, + WaypointType type = Waypoint::LINE, + float velocity = 2000.0, + float acceleration = 100.0, + bool cont = false, + unsigned int tool = 0, + unsigned int base = 0); ~Waypoint(); // from base class - virtual unsigned int getMemSize (void) const; - virtual void Save (Base::Writer &/*writer*/) const; - virtual void Restore(Base::XMLReader &/*reader*/); + virtual unsigned int getMemSize(void) const; + virtual void Save(Base::Writer& /*writer*/) const; + virtual void Restore(Base::XMLReader& /*reader*/); std::string Name; WaypointType Type; float Velocity; - float Accelaration; + float Acceleration; bool Cont; unsigned int Tool,Base; Base::Placement EndPos; diff --git a/src/Mod/Robot/App/WaypointPyImp.cpp b/src/Mod/Robot/App/WaypointPyImp.cpp index 4fd590cdba..611e6c85fe 100644 --- a/src/Mod/Robot/App/WaypointPyImp.cpp +++ b/src/Mod/Robot/App/WaypointPyImp.cpp @@ -83,60 +83,60 @@ PyObject *WaypointPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // P // constructor method int WaypointPy::PyInit(PyObject* args, PyObject* kwd) { - PyObject *pos; - char *name="P"; - char *type = "PTP"; - PyObject *vel = 0; - PyObject *acc = 0; + PyObject* pos; + char* name = "P"; + char* type = "PTP"; + PyObject* vel = 0; + PyObject* acc = 0; int cont = 0; - int tool=0; - int base=0; + int tool = 0; + int base = 0; - static char *kwlist[] = {"Pos", "type","name", "vel", "cont", "tool", "base", "acc" ,NULL}; + static char* kwlist[] = { "Pos", "type","name", "vel", "cont", "tool", "base", "acc" ,NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwd, "O!|ssOiiiO", kwlist, - &(Base::PlacementPy::Type), &pos, // the placement object - &type, &name, &vel, &cont, &tool, &base, &acc )) + &(Base::PlacementPy::Type), &pos, // the placement object + &type, &name, &vel, &cont, &tool, &base, &acc)) return -1; Base::Placement TempPos = *static_cast(pos)->getPlacementPtr(); getWaypointPtr()->EndPos = TempPos; - getWaypointPtr()->Name = name; + getWaypointPtr()->Name = name; std::string typeStr(type); - if(typeStr=="PTP") + if (typeStr == "PTP") getWaypointPtr()->Type = Waypoint::PTP; - else if(typeStr=="LIN") + else if (typeStr == "LIN") getWaypointPtr()->Type = Waypoint::LINE; - else if(typeStr=="CIRC") + else if (typeStr == "CIRC") getWaypointPtr()->Type = Waypoint::CIRC; - else if(typeStr=="WAIT") + else if (typeStr == "WAIT") getWaypointPtr()->Type = Waypoint::WAIT; - else + else getWaypointPtr()->Type = Waypoint::UNDEF; - if(vel == 0) - switch (getWaypointPtr()->Type){ - case Waypoint::PTP: - getWaypointPtr()->Velocity = 100; - break; - case Waypoint::LINE: - getWaypointPtr()->Velocity = 2000; - break; - case Waypoint::CIRC: - getWaypointPtr()->Velocity = 2000; - break; - default: - getWaypointPtr()->Velocity = 0; + if (vel == 0) + switch (getWaypointPtr()->Type) { + case Waypoint::PTP: + getWaypointPtr()->Velocity = 100; + break; + case Waypoint::LINE: + getWaypointPtr()->Velocity = 2000; + break; + case Waypoint::CIRC: + getWaypointPtr()->Velocity = 2000; + break; + default: + getWaypointPtr()->Velocity = 0; } else - getWaypointPtr()->Velocity = Base::UnitsApi::toDouble(vel,Base::Unit::Velocity); - getWaypointPtr()->Cont = cont?true:false; + getWaypointPtr()->Velocity = Base::UnitsApi::toDouble(vel, Base::Unit::Velocity); + getWaypointPtr()->Cont = cont ? true : false; getWaypointPtr()->Tool = tool; getWaypointPtr()->Base = base; - if(acc == 0) - getWaypointPtr()->Accelaration = 100; + if (acc == 0) + getWaypointPtr()->Acceleration = 100; else - getWaypointPtr()->Accelaration = Base::UnitsApi::toDouble(acc,Base::Unit::Acceleration); + getWaypointPtr()->Acceleration = Base::UnitsApi::toDouble(acc, Base::Unit::Acceleration); return 0; } diff --git a/src/Mod/Robot/App/kdl_cp/chainfksolver.hpp b/src/Mod/Robot/App/kdl_cp/chainfksolver.hpp index ea2f333d25..4c22a1a1f6 100644 --- a/src/Mod/Robot/App/kdl_cp/chainfksolver.hpp +++ b/src/Mod/Robot/App/kdl_cp/chainfksolver.hpp @@ -1,111 +1,111 @@ -// Copyright (C) 2007 Ruben Smits - -// Version: 1.0 -// Author: Ruben Smits -// Maintainer: Ruben Smits -// URL: http://www.orocos.org/kdl - -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. - -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -#ifndef KDL_CHAIN_FKSOLVER_HPP -#define KDL_CHAIN_FKSOLVER_HPP - -#include "chain.hpp" -#include "framevel.hpp" -#include "frameacc.hpp" -#include "jntarray.hpp" -#include "jntarrayvel.hpp" -#include "jntarrayacc.hpp" -#include "solveri.hpp" - -namespace KDL { - - /** - * \brief This abstract class encapsulates a - * solver for the forward position kinematics for a KDL::Chain. - * - * @ingroup KinematicFamily - */ - - //Forward definition - class ChainFkSolverPos : public KDL::SolverI { - public: - /** - * Calculate forward position kinematics for a KDL::Chain, - * from joint coordinates to cartesian pose. - * - * @param q_in input joint coordinates - * @param p_out reference to output cartesian pose - * @param segmentNr default to -1 - * - * @return if < 0 something went wrong - */ - virtual int JntToCart(const JntArray& q_in, Frame& p_out,int segmentNr=-1)=0; - virtual ~ChainFkSolverPos(){}; - }; - - /** - * \brief This abstract class encapsulates a solver - * for the forward velocity kinematics for a KDL::Chain. - * - * @ingroup KinematicFamily - */ - class ChainFkSolverVel : public KDL::SolverI { - public: - /** - * Calculate forward position and velocity kinematics, from - * joint coordinates to cartesian coordinates. - * - * @param q_in input joint coordinates (position and velocity) - * @param out output cartesian coordinates (position and velocity) - * @param segmentNr default to -1 - * - * @return if < 0 something went wrong - */ - virtual int JntToCart(const JntArrayVel& q_in, FrameVel& out,int segmentNr=-1)=0; - - virtual ~ChainFkSolverVel(){}; - }; - - /** - * \brief This abstract class encapsulates a solver - * for the forward acceleration kinematics for a KDL::Chain. - * - * @ingroup KinematicFamily - */ - - class ChainFkSolverAcc : public KDL::SolverI { - public: - /** - * Calculate forward position, velocity and accelaration - * kinematics, from joint coordinates to cartesian coordinates - * - * @param q_in input joint coordinates (position, velocity and - * acceleration - * @param out output cartesian coordinates (position, velocity - * and acceleration - * @param segmentNr default to -1 - * - * @return if < 0 something went wrong - */ - virtual int JntToCart(const JntArrayAcc& q_in, FrameAcc& out,int segmentNr=-1)=0; - - virtual ~ChainFkSolverAcc()=0; - }; - - -}//end of namespace KDL - -#endif +// Copyright (C) 2007 Ruben Smits + +// Version: 1.0 +// Author: Ruben Smits +// Maintainer: Ruben Smits +// URL: http://www.orocos.org/kdl + +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. + +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#ifndef KDL_CHAIN_FKSOLVER_HPP +#define KDL_CHAIN_FKSOLVER_HPP + +#include "chain.hpp" +#include "framevel.hpp" +#include "frameacc.hpp" +#include "jntarray.hpp" +#include "jntarrayvel.hpp" +#include "jntarrayacc.hpp" +#include "solveri.hpp" + +namespace KDL { + + /** + * \brief This abstract class encapsulates a + * solver for the forward position kinematics for a KDL::Chain. + * + * @ingroup KinematicFamily + */ + + //Forward definition + class ChainFkSolverPos : public KDL::SolverI { + public: + /** + * Calculate forward position kinematics for a KDL::Chain, + * from joint coordinates to cartesian pose. + * + * @param q_in input joint coordinates + * @param p_out reference to output cartesian pose + * @param segmentNr default to -1 + * + * @return if < 0 something went wrong + */ + virtual int JntToCart(const JntArray& q_in, Frame& p_out,int segmentNr=-1)=0; + virtual ~ChainFkSolverPos(){}; + }; + + /** + * \brief This abstract class encapsulates a solver + * for the forward velocity kinematics for a KDL::Chain. + * + * @ingroup KinematicFamily + */ + class ChainFkSolverVel : public KDL::SolverI { + public: + /** + * Calculate forward position and velocity kinematics, from + * joint coordinates to cartesian coordinates. + * + * @param q_in input joint coordinates (position and velocity) + * @param out output cartesian coordinates (position and velocity) + * @param segmentNr default to -1 + * + * @return if < 0 something went wrong + */ + virtual int JntToCart(const JntArrayVel& q_in, FrameVel& out,int segmentNr=-1)=0; + + virtual ~ChainFkSolverVel(){}; + }; + + /** + * \brief This abstract class encapsulates a solver + * for the forward acceleration kinematics for a KDL::Chain. + * + * @ingroup KinematicFamily + */ + + class ChainFkSolverAcc : public KDL::SolverI { + public: + /** + * Calculate forward position, velocity and acceleration + * kinematics, from joint coordinates to cartesian coordinates + * + * @param q_in input joint coordinates (position, velocity and + * acceleration + * @param out output cartesian coordinates (position, velocity + * and acceleration + * @param segmentNr default to -1 + * + * @return if < 0 something went wrong + */ + virtual int JntToCart(const JntArrayAcc& q_in, FrameAcc& out,int segmentNr=-1)=0; + + virtual ~ChainFkSolverAcc()=0; + }; + + +}//end of namespace KDL + +#endif diff --git a/src/Mod/Robot/App/kdl_cp/treefksolver.hpp b/src/Mod/Robot/App/kdl_cp/treefksolver.hpp index bbbed69680..b27e5c29cb 100644 --- a/src/Mod/Robot/App/kdl_cp/treefksolver.hpp +++ b/src/Mod/Robot/App/kdl_cp/treefksolver.hpp @@ -1,110 +1,110 @@ -// Copyright (C) 2007 Ruben Smits -// Copyright (C) 2008 Julia Jesse - -// Version: 1.0 -// Author: Ruben Smits -// Maintainer: Ruben Smits -// URL: http://www.orocos.org/kdl - -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. - -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -#ifndef KDL_TREE_FKSOLVER_HPP -#define KDL_TREE_FKSOLVER_HPP - -#include - -#include "tree.hpp" -//#include "framevel.hpp" -//#include "frameacc.hpp" -#include "jntarray.hpp" -//#include "jntarrayvel.hpp" -//#include "jntarrayacc.hpp" - -namespace KDL { - - /** - * \brief This abstract class encapsulates a - * solver for the forward position kinematics for a KDL::Tree. - * - * @ingroup KinematicFamily - */ - - //Forward definition - class TreeFkSolverPos { - public: - /** - * Calculate forward position kinematics for a KDL::Tree, - * from joint coordinates to cartesian pose. - * - * @param q_in input joint coordinates - * @param p_out reference to output cartesian pose - * @param segmentName - * @return if < 0 something went wrong - */ - virtual int JntToCart(const JntArray& q_in, Frame& p_out, std::string segmentName)=0; - virtual ~TreeFkSolverPos(){}; - }; - - /** - * \brief This abstract class encapsulates a solver - * for the forward velocity kinematics for a KDL::Tree. - * - * @ingroup KinematicFamily - */ -// class TreeFkSolverVel { -// public: - /** - * Calculate forward position and velocity kinematics, from - * joint coordinates to cartesian coordinates. - * - * @param q_in input joint coordinates (position and velocity) - * @param out output cartesian coordinates (position and velocity) - * - * @return if < 0 something went wrong - */ -// virtual int JntToCart(const JntArrayVel& q_in, FrameVel& out,int segmentNr=-1)=0; - -// virtual ~TreeFkSolverVel(){}; -// }; - - /** - * \brief This abstract class encapsulates a solver - * for the forward acceleration kinematics for a KDL::Tree. - * - * @ingroup KinematicFamily - */ - -// class TreeFkSolverAcc { -// public: - /** - * Calculate forward position, velocity and accelaration - * kinematics, from joint coordinates to cartesian coordinates - * - * @param q_in input joint coordinates (position, velocity and - * acceleration - @param out output cartesian coordinates (position, velocity - * and acceleration - * - * @return if < 0 something went wrong - */ -// virtual int JntToCart(const JntArrayAcc& q_in, FrameAcc& out,int segmentNr=-1)=0; - -// virtual ~TreeFkSolverAcc()=0; -// }; - - -}//end of namespace KDL - -#endif +// Copyright (C) 2007 Ruben Smits +// Copyright (C) 2008 Julia Jesse + +// Version: 1.0 +// Author: Ruben Smits +// Maintainer: Ruben Smits +// URL: http://www.orocos.org/kdl + +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. + +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#ifndef KDL_TREE_FKSOLVER_HPP +#define KDL_TREE_FKSOLVER_HPP + +#include + +#include "tree.hpp" +//#include "framevel.hpp" +//#include "frameacc.hpp" +#include "jntarray.hpp" +//#include "jntarrayvel.hpp" +//#include "jntarrayacc.hpp" + +namespace KDL { + + /** + * \brief This abstract class encapsulates a + * solver for the forward position kinematics for a KDL::Tree. + * + * @ingroup KinematicFamily + */ + + //Forward definition + class TreeFkSolverPos { + public: + /** + * Calculate forward position kinematics for a KDL::Tree, + * from joint coordinates to cartesian pose. + * + * @param q_in input joint coordinates + * @param p_out reference to output cartesian pose + * @param segmentName + * @return if < 0 something went wrong + */ + virtual int JntToCart(const JntArray& q_in, Frame& p_out, std::string segmentName)=0; + virtual ~TreeFkSolverPos(){}; + }; + + /** + * \brief This abstract class encapsulates a solver + * for the forward velocity kinematics for a KDL::Tree. + * + * @ingroup KinematicFamily + */ +// class TreeFkSolverVel { +// public: + /** + * Calculate forward position and velocity kinematics, from + * joint coordinates to cartesian coordinates. + * + * @param q_in input joint coordinates (position and velocity) + * @param out output cartesian coordinates (position and velocity) + * + * @return if < 0 something went wrong + */ +// virtual int JntToCart(const JntArrayVel& q_in, FrameVel& out,int segmentNr=-1)=0; + +// virtual ~TreeFkSolverVel(){}; +// }; + + /** + * \brief This abstract class encapsulates a solver + * for the forward acceleration kinematics for a KDL::Tree. + * + * @ingroup KinematicFamily + */ + +// class TreeFkSolverAcc { +// public: + /** + * Calculate forward position, velocity and acceleration + * kinematics, from joint coordinates to cartesian coordinates + * + * @param q_in input joint coordinates (position, velocity and + * acceleration + @param out output cartesian coordinates (position, velocity + * and acceleration + * + * @return if < 0 something went wrong + */ +// virtual int JntToCart(const JntArrayAcc& q_in, FrameAcc& out,int segmentNr=-1)=0; + +// virtual ~TreeFkSolverAcc()=0; +// }; + + +}//end of namespace KDL + +#endif diff --git a/src/Mod/Robot/Gui/AppRobotGui.cpp b/src/Mod/Robot/Gui/AppRobotGui.cpp index a9e815f754..fe39f49072 100644 --- a/src/Mod/Robot/Gui/AppRobotGui.cpp +++ b/src/Mod/Robot/Gui/AppRobotGui.cpp @@ -92,7 +92,7 @@ PyMOD_INIT_FUNC(RobotGui) // default Cintinuity is off Base::Interpreter().runString("_DefCont = False"); // default Cintinuity is off - Base::Interpreter().runString("_DefAccelaration = '1 m/s^2'"); + Base::Interpreter().runString("_DefAcceleration = '1 m/s^2'"); // default orientation of a waypoint if no other constraint Base::Interpreter().runString("_DefOrientation = FreeCAD.Rotation()"); // default displacement while e.g. picking diff --git a/src/Mod/Robot/Gui/CommandTrajectory.cpp b/src/Mod/Robot/Gui/CommandTrajectory.cpp index 9302ea0660..faae1537d9 100644 --- a/src/Mod/Robot/Gui/CommandTrajectory.cpp +++ b/src/Mod/Robot/Gui/CommandTrajectory.cpp @@ -130,7 +130,7 @@ void CmdRobotInsertWaypoint::activated(int) std::string TrakName = pcTrajectoryObject->getNameInDocument(); openCommand("Insert waypoint"); - doCommand(Doc,"App.activeDocument().%s.Trajectory = App.activeDocument().%s.Trajectory.insertWaypoints(Robot.Waypoint(App.activeDocument().%s.Tcp.multiply(App.activeDocument().%s.Tool),type='LIN',name='Pt',vel=_DefSpeed,cont=_DefCont,acc=_DefAccelaration,tool=1))",TrakName.c_str(),TrakName.c_str(),RoboName.c_str(),RoboName.c_str()); + doCommand(Doc,"App.activeDocument().%s.Trajectory = App.activeDocument().%s.Trajectory.insertWaypoints(Robot.Waypoint(App.activeDocument().%s.Tcp.multiply(App.activeDocument().%s.Tool),type='LIN',name='Pt',vel=_DefSpeed,cont=_DefCont,acc=_DefAcceleration,tool=1))",TrakName.c_str(),TrakName.c_str(),RoboName.c_str(),RoboName.c_str()); updateActive(); commitCommand(); @@ -194,7 +194,7 @@ void CmdRobotInsertWaypointPreselect::activated(int) } openCommand("Insert waypoint"); - doCommand(Doc,"App.activeDocument().%s.Trajectory = App.activeDocument().%s.Trajectory.insertWaypoints(Robot.Waypoint(FreeCAD.Placement(FreeCAD.Vector(%f,%f,%f)+_DefDisplacement,_DefOrientation),type='LIN',name='Pt',vel=_DefSpeed,cont=_DefCont,acc=_DefAccelaration,tool=1))",TrakName.c_str(),TrakName.c_str(),x,y,z); + doCommand(Doc,"App.activeDocument().%s.Trajectory = App.activeDocument().%s.Trajectory.insertWaypoints(Robot.Waypoint(FreeCAD.Placement(FreeCAD.Vector(%f,%f,%f)+_DefDisplacement,_DefOrientation),type='LIN',name='Pt',vel=_DefSpeed,cont=_DefCont,acc=_DefAcceleration,tool=1))",TrakName.c_str(),TrakName.c_str(),x,y,z); updateActive(); commitCommand(); @@ -286,7 +286,7 @@ void CmdRobotSetDefaultValues::activated(int) QObject::tr("acceleration: (e.g. 1 m/s^2 or 3 cm/s^2)"), QLineEdit::Normal, QString::fromLatin1("1 m/s^2"), &ok, Qt::MSWindowsFixedSizeDialogHint); if ( ok && !text.isEmpty() ) { - doCommand(Doc,"_DefAccelaration = '%s'",text.toLatin1().constData()); + doCommand(Doc,"_DefAcceleration = '%s'",text.toLatin1().constData()); } diff --git a/src/Mod/Robot/Gui/TaskTrajectory.cpp b/src/Mod/Robot/Gui/TaskTrajectory.cpp index aa327d3a05..a85420bbac 100644 --- a/src/Mod/Robot/Gui/TaskTrajectory.cpp +++ b/src/Mod/Robot/Gui/TaskTrajectory.cpp @@ -81,7 +81,7 @@ TaskTrajectory::TaskTrajectory(Robot::RobotObject *pcRobotObject,Robot::Trajecto else ui->trajectoryTable->setItem(i, 2, new QTableWidgetItem(QString::fromLatin1("-"))); ui->trajectoryTable->setItem(i, 3, new QTableWidgetItem(QString::number(pt.Velocity))); - ui->trajectoryTable->setItem(i, 4, new QTableWidgetItem(QString::number(pt.Accelaration))); + ui->trajectoryTable->setItem(i, 4, new QTableWidgetItem(QString::number(pt.Acceleration))); } diff --git a/src/Mod/Robot/Gui/TrajectorySimulate.cpp b/src/Mod/Robot/Gui/TrajectorySimulate.cpp index c72010510d..4d0724fa76 100644 --- a/src/Mod/Robot/Gui/TrajectorySimulate.cpp +++ b/src/Mod/Robot/Gui/TrajectorySimulate.cpp @@ -79,7 +79,7 @@ TrajectorySimulate::TrajectorySimulate(Robot::RobotObject *pcRobotObject,Robot:: else ui->trajectoryTable->setItem(i, 2, new QTableWidgetItem(QString::fromLatin1("-"))); ui->trajectoryTable->setItem(i, 3, new QTableWidgetItem(QString::number(pt.Velocity))); - ui->trajectoryTable->setItem(i, 4, new QTableWidgetItem(QString::number(pt.Accelaration))); + ui->trajectoryTable->setItem(i, 4, new QTableWidgetItem(QString::number(pt.Acceleration))); }