The representation of a Trajectory. More...
#include <Trajectory.h>
Public Member Functions | |
void | addWaypoint (const Waypoint &WPnt) |
void | deleteLast (unsigned int n=1) |
delete the last n waypoints | |
void | generateTrajectory (void) |
double | getDuration (int n=-1) const |
return the duration (s) of the Trajectory if -1 or of the Waypoint with the given number | |
double | getLength (int n=-1) const |
return the Length (mm) of the Trajectory if -1 or of the Waypoint with the given number | |
virtual unsigned int | getMemSize (void) const |
This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB? | |
Base::Placement | getPosition (double time) const |
unsigned int | getSize (void) const |
virtual Base::Type | getTypeId (void) const |
std::string | getUniqueWaypointName (const char *Name) const |
double | getVelocity (double time) const |
const Waypoint & | getWaypoint (unsigned int pos) const |
const std::vector< Waypoint * > & | getWaypoints (void) const |
Trajectory & | operator= (const Trajectory &) |
virtual void | Restore (Base::XMLReader &) |
This method is used to restore properties from an XML document. | |
virtual void | Save (Base::Writer &) const |
This method is used to save properties to an XML document. | |
Trajectory (const Trajectory &) | |
Trajectory () | |
~Trajectory () | |
Static Public Member Functions | |
static void * | create (void) |
static Base::Type | getClassTypeId (void) |
static void | init (void) |
Protected Attributes | |
KDL::Trajectory_Composite * | pcTrajectory |
std::vector< Waypoint * > | vpcWaypoints |
The representation of a Trajectory.
Definition at line 44 of file Trajectory.h.
Trajectory::Trajectory | ( | ) |
Definition at line 62 of file trajectory.cpp.
Trajectory::Trajectory | ( | const Trajectory & | Trac | ) |
Definition at line 68 of file trajectory.cpp.
References operator=().
Trajectory::~Trajectory | ( | ) |
Definition at line 74 of file trajectory.cpp.
References pcTrajectory, and vpcWaypoints.
void Trajectory::addWaypoint | ( | const Waypoint & | WPnt | ) |
Definition at line 278 of file trajectory.cpp.
References getUniqueWaypointName(), Robot::Waypoint::Name, and vpcWaypoints.
Referenced by Robot::TrajectoryDressUpObject::execute(), Robot::TrajectoryCompound::execute(), Robot::Edge2TracObject::execute(), Robot::TrajectoryPy::insertWaypoints(), and Robot::TrajectoryPy::PyInit().
void * Robot::Trajectory::create | ( | void | ) | [static] |
Reimplemented from Base::Persistence.
Definition at line 60 of file trajectory.cpp.
void Trajectory::deleteLast | ( | unsigned int | n = 1 |
) |
delete the last n waypoints
Definition at line 136 of file trajectory.cpp.
References vpcWaypoints.
Referenced by Robot::TrajectoryPy::deleteLast().
void Trajectory::generateTrajectory | ( | void | ) |
Definition at line 146 of file trajectory.cpp.
References KDL::Trajectory_Composite::Add(), KDL::Path_RoundedComposite::Add(), KDL::Error::Description(), KDL::Path_RoundedComposite::Finish(), Robot::Waypoint::LINE, KDL::Path::PathLength(), KDL::Path_RoundedComposite::PathLength(), pcTrajectory, Robot::Waypoint::PTP, KDL::VelocityProfile::SetProfile(), Robot::toFrame(), vpcWaypoints, and Robot::Waypoint::WAIT.
Referenced by Robot::TrajectoryPy::insertWaypoints(), operator=(), Robot::TrajectoryPy::PyInit(), and Restore().
Base::Type Robot::Trajectory::getClassTypeId | ( | void | ) | [static] |
Reimplemented from Base::Persistence.
Definition at line 60 of file trajectory.cpp.
double Trajectory::getDuration | ( | int | n = -1 |
) | const |
return the duration (s) of the Trajectory if -1 or of the Waypoint with the given number
Definition at line 107 of file trajectory.cpp.
References KDL::Trajectory_Composite::Duration(), KDL::Trajectory_Composite::Get(), and pcTrajectory.
Referenced by Robot::Simulation::getDuration(), Robot::TrajectoryPy::representation(), RobotGui::TaskTrajectory::TaskTrajectory(), and RobotGui::TrajectorySimulate::TrajectorySimulate().
double Trajectory::getLength | ( | int | n = -1 |
) | const |
return the Length (mm) of the Trajectory if -1 or of the Waypoint with the given number
Definition at line 96 of file trajectory.cpp.
References KDL::Trajectory_Composite::Get(), KDL::Trajectory_Composite::GetPath(), and pcTrajectory.
Referenced by Robot::Simulation::getLength(), and Robot::TrajectoryPy::representation().
unsigned int Trajectory::getMemSize | ( | void | ) | const [virtual] |
This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB?
Implements Base::Persistence.
Definition at line 289 of file trajectory.cpp.
Referenced by Robot::PropertyTrajectory::getMemSize().
Placement Trajectory::getPosition | ( | double | time | ) | const |
Definition at line 118 of file trajectory.cpp.
References pcTrajectory, KDL::Trajectory_Composite::Pos(), and Robot::toPlacement().
Referenced by Robot::Simulation::getPosition(), Robot::Simulation::reset(), and Robot::Simulation::setToTime().
unsigned int Robot::Trajectory::getSize | ( | void | ) | const [inline] |
Definition at line 63 of file Trajectory.h.
Referenced by Robot::TrajectoryPy::getWaypoints(), Robot::TrajectoryPy::representation(), Save(), Robot::Simulation::Simulation(), RobotGui::TaskTrajectory::TaskTrajectory(), RobotGui::TrajectorySimulate::TrajectorySimulate(), and RobotGui::ViewProviderTrajectory::updateData().
Base::Type Robot::Trajectory::getTypeId | ( | void | ) | const [virtual] |
Reimplemented from Base::Persistence.
Definition at line 60 of file trajectory.cpp.
std::string Trajectory::getUniqueWaypointName | ( | const char * | Name | ) | const |
Definition at line 231 of file trajectory.cpp.
References vpcWaypoints.
Referenced by addWaypoint().
double Trajectory::getVelocity | ( | double | time | ) | const |
Definition at line 126 of file trajectory.cpp.
References Base::Vector3< _Precision >::Length(), pcTrajectory, draftlibs::fcgeo::vec(), and KDL::Trajectory_Composite::Vel().
Referenced by Robot::Simulation::getVelocity().
const Waypoint& Robot::Trajectory::getWaypoint | ( | unsigned int | pos | ) | const [inline] |
Definition at line 64 of file Trajectory.h.
Referenced by RobotGui::TaskTrajectory::TaskTrajectory(), RobotGui::TrajectorySimulate::TrajectorySimulate(), and RobotGui::ViewProviderTrajectory::updateData().
const std::vector<Waypoint*>& Robot::Trajectory::getWaypoints | ( | void | ) | const [inline] |
Definition at line 66 of file Trajectory.h.
void Robot::Trajectory::init | ( | void | ) | [static] |
Reimplemented from Base::Persistence.
Definition at line 60 of file trajectory.cpp.
Referenced by initRobot().
Trajectory & Trajectory::operator= | ( | const Trajectory & | Trac | ) |
Definition at line 81 of file trajectory.cpp.
References generateTrajectory(), and vpcWaypoints.
Referenced by Trajectory().
void Trajectory::Restore | ( | Base::XMLReader & | ) | [virtual] |
This method is used to restore properties from an XML document.
It uses the XMLReader class, which bases on SAX, to read the in Save() written information. Again the Vector as an example:
void PropertyVector::Restore(Base::XMLReader &reader) { // read my Element reader.readElement("PropertyVector"); // get the value of my Attribute _cVec.x = (float)reader.getAttributeAsFloat("valueX"); _cVec.y = (float)reader.getAttributeAsFloat("valueY"); _cVec.z = (float)reader.getAttributeAsFloat("valueZ"); }
Implements Base::Persistence.
Definition at line 305 of file trajectory.cpp.
References RobotExampleTrajectoryOutOfShapes::count, generateTrajectory(), Base::XMLReader::getAttributeAsInteger(), Base::XMLReader::readElement(), Robot::Waypoint::Restore(), and vpcWaypoints.
Referenced by Robot::PropertyTrajectory::Restore().
void Trajectory::Save | ( | Base::Writer & | ) | const [virtual] |
This method is used to save properties to an XML document.
A good example you'll find in PropertyStandard.cpp, e.g. the vector:
void PropertyVector::Save (Writer &writer) const { writer << writer.ind() << "<PropertyVector valueX=\"" << _cVec.x << "\" valueY=\"" << _cVec.y << "\" valueZ=\"" << _cVec.z <<"\"/>" << endl; }
The writer.ind() expression writes the indention, just for pretty printing of the XML. As you see, the writing of the XML document is not done with a DOM implementation because of performance reasons. Therefore the programmer has to take care that a valid XML document is written. This means closing tags and writing UTF-8.
Implements Base::Persistence.
Definition at line 294 of file trajectory.cpp.
References Base::Writer::decInd(), getSize(), Base::Writer::incInd(), Base::Writer::ind(), Base::Writer::Stream(), and vpcWaypoints.
Referenced by Robot::PropertyTrajectory::Save().
KDL::Trajectory_Composite* Robot::Trajectory::pcTrajectory [protected] |
Definition at line 82 of file Trajectory.h.
Referenced by generateTrajectory(), getDuration(), getLength(), getPosition(), getVelocity(), and ~Trajectory().
std::vector<Waypoint*> Robot::Trajectory::vpcWaypoints [protected] |
Definition at line 80 of file Trajectory.h.
Referenced by addWaypoint(), deleteLast(), generateTrajectory(), getUniqueWaypointName(), operator=(), Restore(), Save(), and ~Trajectory().