#include <TrajectoryThread.h>
|
| TrajectoryThread (int period, const std::string &taskPortName, const TRAJECTORY_TYPE=MIN_JERK, const TERMINATION_STRATEGY _terminationStrategy=STOP_THREAD) |
|
| TrajectoryThread (int period, const std::string &taskPortName, const Eigen::MatrixXd &waypoints, const TRAJECTORY_TYPE=MIN_JERK, const TERMINATION_STRATEGY _terminationStrategy=STOP_THREAD) |
|
| TrajectoryThread (int period, const std::string &taskPortName, const std::list< Eigen::VectorXd > &waypoints, const TRAJECTORY_TYPE=MIN_JERK, const TERMINATION_STRATEGY _terminationStrategy=STOP_THREAD) |
|
| ~TrajectoryThread () |
|
virtual bool | threadInit () |
|
virtual void | threadRelease () |
|
virtual void | run () |
|
void | pause () |
|
void | unpause () |
|
void | setMaxVelocity (double maxVel) |
|
void | setMaxVelocity (Eigen::VectorXd maxVel) |
|
void | setMaxAcceleration (double maxAcc) |
|
void | setMaxAcceleration (Eigen::VectorXd maxAcc) |
|
bool | setDisplacement (double dispDouble) |
|
bool | setDisplacement (const Eigen::VectorXd &displacementVector) |
|
bool | setTrajectoryWaypoints (const Eigen::MatrixXd &userWaypoints, bool containsStartingWaypoint=false) |
|
bool | setTrajectoryWaypoints (const std::list< Eigen::VectorXd > &waypointList, bool containsStartingWaypoint=false) |
|
void | setTerminationStrategy (const TERMINATION_STRATEGY newTermStrat) |
|
void | setGoalErrorThreshold (const double newErrorThresh) |
|
void | setUseVarianceModulation (bool newVarMod) |
|
bool | goalAttained () |
|
double | getDiffError () |
|
double | getDuration () |
|
std::list< Eigen::VectorXd > | getWaypointList () |
|
void | returnToHome () |
|
bool | isReturningHome () |
|
Eigen::MatrixXd | getWaypoints () |
|
void | setMaxVelocityAndAcceleration (double maxVel, double maxAcc) |
|
void | setMaxVelocityAndAcceleration (const Eigen::VectorXd &maxVel, const Eigen::VectorXd &maxAcc) |
|
ocra::Trajectory::Ptr | getTrajectory () |
|
Definition at line 69 of file TrajectoryThread.h.
TrajectoryThread::~TrajectoryThread |
( |
| ) |
|
void TrajectoryThread::cycleWaypoints |
( |
| ) |
|
|
protected |
void TrajectoryThread::flipWaypoints |
( |
| ) |
|
|
protected |
double TrajectoryThread::getDiffError |
( |
| ) |
|
Computes the task error as the difference between the goal state vector and its current state
Definition at line 380 of file TrajectoryThread.cpp.
double TrajectoryThread::getDuration |
( |
| ) |
|
ocra::Trajectory::Ptr ocra_recipes::TrajectoryThread::getTrajectory |
( |
| ) |
|
|
inline |
std::list< Eigen::VectorXd > TrajectoryThread::getWaypointList |
( |
| ) |
|
Eigen::MatrixXd ocra_recipes::TrajectoryThread::getWaypoints |
( |
| ) |
|
|
inline |
bool TrajectoryThread::goalAttained |
( |
| ) |
|
Computes the norm of the difference between the goal state vector and its current state.
- Returns
- True if the difference is less than the error threshold.
Definition at line 371 of file TrajectoryThread.cpp.
void TrajectoryThread::init |
( |
| ) |
|
|
protected |
bool ocra_recipes::TrajectoryThread::isReturningHome |
( |
| ) |
|
|
inline |
void TrajectoryThread::pause |
( |
| ) |
|
Sets isPaused to true of this class and registers the pausing time.
Definition at line 348 of file TrajectoryThread.cpp.
void TrajectoryThread::returnToHome |
( |
| ) |
|
void TrajectoryThread::run |
( |
| ) |
|
|
virtual |
If the control ports are open (for the specific task associated to the trajectory) this method will mainly write to a port the new desired task state. It also handles the trajectory termination strategy. When the goal is reached, there will be 6 possible termination strategies: BACK_AND_FORTH, CYCLE, STOP_THREAD, STOP_THREAD_DEACTIVATE, WAIT, WAIT_DEACTIVATE. BACK_AND_FORTH: will invert the trajectory waypoints once all of them have been met. CYCLE: The trajectory will cycle over. STOP_THREAD: The thread will stop once the trajectory is finished. STOP_THREAD_DEACTIVATE: The task is first deactivated and then thread is stopped. If the task cannot be deactivated, the thread will wait 1 second before trying once more. WAIT: The thread will wait for new commands to arrive. WAIT_DEACTIVATE: It will first deactivate the task and then wait for new commands. If the task cannot be deactivated, the thread will wait 1 second before trying once more.
Definition at line 171 of file TrajectoryThread.cpp.
bool TrajectoryThread::setDisplacement |
( |
double |
dispDouble | ) |
|
Sets a displacement vector with the same constant value for each element and consistent with the weight dimension.
- Parameters
-
dispDouble | Constant displacement value. |
- Returns
- True when the new trajectory waypoints have been set, false otherwise.
Definition at line 497 of file TrajectoryThread.cpp.
bool TrajectoryThread::setDisplacement |
( |
const Eigen::VectorXd & |
displacementVector | ) |
|
Adds a displacement offset to the waypoints.
- Parameters
-
displacementVector | Vector of displacement with the same number of rows as the weight dimension. |
- Returns
- true when the new trajectory waypoints have been set, false otherwise.
Definition at line 502 of file TrajectoryThread.cpp.
void ocra_recipes::TrajectoryThread::setGoalErrorThreshold |
( |
const double |
newErrorThresh | ) |
|
|
inline |
Stablishes the admissible error for the trajectory at hand. In particular sets the variable errorThreshold of this class.
- Parameters
-
newErrorThresh | Error threshold. |
Definition at line 171 of file TrajectoryThread.h.
void TrajectoryThread::setMaxAcceleration |
( |
double |
maxAcc | ) |
|
void TrajectoryThread::setMaxAcceleration |
( |
Eigen::VectorXd |
maxAcc | ) |
|
void TrajectoryThread::setMaxVelocity |
( |
double |
maxVel | ) |
|
void TrajectoryThread::setMaxVelocity |
( |
Eigen::VectorXd |
maxVel | ) |
|
void TrajectoryThread::setMaxVelocityAndAcceleration |
( |
double |
maxVel, |
|
|
double |
maxAcc |
|
) |
| |
void TrajectoryThread::setMaxVelocityAndAcceleration |
( |
const Eigen::VectorXd & |
maxVel, |
|
|
const Eigen::VectorXd & |
maxAcc |
|
) |
| |
void ocra_recipes::TrajectoryThread::setTerminationStrategy |
( |
const TERMINATION_STRATEGY |
newTermStrat | ) |
|
|
inline |
Tells the thread what to do when the trajectory has been fulfilled. In particular sets the variable termimationStrategy of this class.
- Parameters
-
newTermStrat | Options are: BACK_AND_FORTH, STOP_THREAD, WAIT, STOP_THREAD_DEACTIVE, WAIT_DEACTIVE, CYCLE |
Definition at line 164 of file TrajectoryThread.h.
bool TrajectoryThread::setTrajectoryWaypoints |
( |
const Eigen::MatrixXd & |
userWaypoints, |
|
|
bool |
containsStartingWaypoint = false |
|
) |
| |
Sets the trajectory waypoints and if the initial waypoint is not included, it adds it by checking the current state of the task at hand. E.g., if it's a COM trajectory it will check the current 3D position of this point and add it at the beginning of the waypoints matrix.
- Parameters
-
[in] | userWaypoints | Column-wise trajectory waypoints. |
[out] | containsStartingWaypoint | True when the starting waypoint is included in the matrix. When false, this method will add it to the waypoints by checking the current state of the task. |
- Returns
- True when the waypoints matrix is consistent with the task dimension and the full waypoints matrix is set. False otherwise.
Definition at line 426 of file TrajectoryThread.cpp.
bool TrajectoryThread::setTrajectoryWaypoints |
( |
const std::list< Eigen::VectorXd > & |
waypointList, |
|
|
bool |
containsStartingWaypoint = false |
|
) |
| |
Sets the trajectory waypoints and if the initial waypoint is not included, it adds it by checking the current state of the task at hand. E.g., if it's a COM trajectory it will check the current 3D position of this point and add it at the beginning of the waypoints matrix.
- Parameters
-
[in] | waypointList | List of trajectory waypoints. |
[out] | containsStartingWaypoint | True when the starting waypoint is included in the matrix. When false, this method will add it to the waypoints by checking the current state of the task. |
- Returns
- True when the waypoints matrix is consistent with the task dimension and the full waypoints matrix is set. False otherwise.
Definition at line 468 of file TrajectoryThread.cpp.
void ocra_recipes::TrajectoryThread::setUseVarianceModulation |
( |
bool |
newVarMod | ) |
|
|
inline |
Assigns a user-given variance to the weights of the task when created the trajectory. Used only when trajectoryType is GAUSSIAN_PROCESS
- Parameters
-
newVarMod | New weight variance modulation. |
Definition at line 178 of file TrajectoryThread.h.
bool TrajectoryThread::threadInit |
( |
| ) |
|
|
virtual |
If the TrajectoryThread object has been instantiated with defined waypoints (i.e. if waypointsHaveBeenSet is true) the waypoints will be set. Note that if an std::list of waypoints is passed to the constructor of this class, the trajectory type must be TIME_OPTIMAL.
- Returns
- True when initial waypoints have been set.
Definition at line 145 of file TrajectoryThread.cpp.
void TrajectoryThread::threadRelease |
( |
| ) |
|
|
virtual |
Closes the control ports opened by the task associated to this trajectory.
Definition at line 165 of file TrajectoryThread.cpp.
void TrajectoryThread::unpause |
( |
| ) |
|
Sets isPaused to false and stores the elapsed time during the pause.
Definition at line 354 of file TrajectoryThread.cpp.
Eigen::VectorXd TrajectoryThread::varianceToWeights |
( |
Eigen::VectorXd & |
desiredVariance, |
|
|
const double |
beta = 1.0 |
|
) |
| |
|
protected |
std::list<Eigen::VectorXd> ocra_recipes::TrajectoryThread::allWaypointList |
|
protected |
Eigen::MatrixXd ocra_recipes::TrajectoryThread::allWaypoints |
|
protected |
double ocra_recipes::TrajectoryThread::deactivationDelay |
|
protected |
bool ocra_recipes::TrajectoryThread::deactivationLatch |
|
protected |
double ocra_recipes::TrajectoryThread::deactivationTimeout |
|
protected |
Eigen::VectorXd ocra_recipes::TrajectoryThread::desiredState |
|
protected |
Eigen::VectorXd ocra_recipes::TrajectoryThread::desiredVariance |
|
protected |
yarp::os::Bottle ocra_recipes::TrajectoryThread::desStateBottle |
|
protected |
double ocra_recipes::TrajectoryThread::errorThreshold |
|
protected |
Eigen::VectorXd ocra_recipes::TrajectoryThread::goalStateVector |
|
protected |
bool ocra_recipes::TrajectoryThread::isPaused |
|
protected |
bool ocra_recipes::TrajectoryThread::isTaskCurrentlyActive |
|
protected |
bool ocra_recipes::TrajectoryThread::isUsingTerminationStrategy |
|
protected |
double ocra_recipes::TrajectoryThread::maximumVariance |
|
protected |
double ocra_recipes::TrajectoryThread::pauseTime |
|
protected |
bool ocra_recipes::TrajectoryThread::printWaitingNoticeOnce |
|
protected |
bool ocra_recipes::TrajectoryThread::returningHome |
|
protected |
Eigen::VectorXd ocra_recipes::TrajectoryThread::startStateVector |
|
protected |
double ocra_recipes::TrajectoryThread::timeElapsedDuringPause |
|
protected |
std::list<Eigen::VectorXd> ocra_recipes::TrajectoryThread::userWaypointList |
|
protected |
Eigen::MatrixXd ocra_recipes::TrajectoryThread::userWaypoints |
|
protected |
bool ocra_recipes::TrajectoryThread::useVarianceModulation |
|
protected |
Eigen::ArrayXd ocra_recipes::TrajectoryThread::varianceThresh |
|
protected |
bool ocra_recipes::TrajectoryThread::waypointsHaveBeenSet |
|
protected |
int ocra_recipes::TrajectoryThread::weightDimension |
|
protected |
The documentation for this class was generated from the following files: