visp
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
visp::Task Class Reference

The task context provides and requires services. It uses an ExecutionEngine to perform its functions. Essential interfaces are operations, data flow ports and properties. These interfaces have been defined using the oroGen specification. In order to modify the interfaces you should (re)use oroGen and rely on the associated workflow. More...

#include <Task.hpp>

Inheritance diagram for visp::Task:

Public Member Functions

 Task (std::string const &name="visp::Task")
 
 Task (std::string const &name, RTT::ExecutionEngine *engine)
 
 ~Task ()
 
bool configureHook ()
 The following lines are template definitions for the various state machine. More...
 
bool startHook ()
 
void updateHook ()
 
void errorHook ()
 
void stopHook ()
 
void cleanupHook ()
 

Protected Member Functions

void updateFeaturesHVS (Points const &corners, vpHomogeneousMatrix const &cdMo)
 
vpHomogeneousMatrix updateDesiredPose (base::LinearAngular6DCommand setpoint)
 
void setGain (double gain, visp::adaptiveGains const &adaptive_gains, bool use_adaptive)
 
void writeVelocities (vpColVector const &v)
 
base::samples::RigidBodyState convertToRbs (vpHomogeneousMatrix pose) const
 
vpMatrix jacobianFromExpectedInputs (const visp::expectedInputs &expected_inputs) const
 
bool readSetpoint (base::LinearAngular6DCommand &setpoint)
 
bool readCorners (Points &corners, std::string const &desired_target)
 
void updateTargetParameters (std::string const &desired_target)
 
void setObjectSize (double object_width, double object_height)
 
virtual bool setDesired_target (std::string const &value)
 

Protected Attributes

visp::expectedInputs expected_inputs
 
visp::controllerState ctrl_state
 
base::LinearAngular6DCommand setpoint
 
vpCameraParameters cam_cal
 
vpServo task
 
vpPoint point [4]
 
vpPoint P
 
vpHomogeneousMatrix cMb
 
vpFeatureDepth depth
 
vpFeaturePoint p
 
vpFeaturePoint pd
 
vpFeatureThetaU tu
 
vpFeatureTranslation t
 
double Zd
 
std::string desired_target
 
double rotation_around_z
 
std::vector< visp::targetObjectParameterstarget_list
 
vpMatrix eJe
 
vpVelocityTwistMatrix cVb
 

Friends

class TaskBase
 

Detailed Description

The task context provides and requires services. It uses an ExecutionEngine to perform its functions. Essential interfaces are operations, data flow ports and properties. These interfaces have been defined using the oroGen specification. In order to modify the interfaces you should (re)use oroGen and rely on the associated workflow.

The name of a TaskContext is primarily defined via:

deployment 'deployment_name'
task('custom_task_name','visp::Task')
end

It can be dynamically adapted when the deployment is called with a prefix argument.

Constructor & Destructor Documentation

Task::Task ( std::string const &  name = "visp::Task")

TaskContext constructor for Task

Parameters
nameName of the task. This name needs to be unique to make it identifiable via nameservices.
initial_stateThe initial TaskState of the TaskContext. Default is Stopped state.
Task::Task ( std::string const &  name,
RTT::ExecutionEngine *  engine 
)

TaskContext constructor for Task

Parameters
nameName of the task. This name needs to be unique to make it identifiable for nameservices.
engineThe RTT Execution engine to be used for this task, which serialises the execution of all commands, programs, state machines and incoming events for a task.
Task::~Task ( )

Default deconstructor of Task

Member Function Documentation

void Task::cleanupHook ( )

This hook is called by Orocos when the state machine transitions from Stopped to PreOperational, requiring the call to configureHook() before calling start() again.

bool Task::configureHook ( )

The following lines are template definitions for the various state machine.

This hook is called by Orocos when the state machine transitions from PreOperational to Stopped. If it returns false, then the component will stay in PreOperational. Otherwise, it goes into Stopped.

It is meaningful only if the #needs_configuration has been specified in the task context definition with (for example):

task_context "TaskName" do
needs_configuration
...
end
base::samples::RigidBodyState Task::convertToRbs ( vpHomogeneousMatrix  pose) const
protected

Convert a visp homogeneus matrix in to a RigidBodyState

Parameters
Homogeneusmatrix representing a pose
Returns
Pose in the RigidBodyState type
void Task::errorHook ( )

This hook is called by Orocos when the component is in the RunTimeError state, at each activity step. See the discussion in updateHook() about triggering options.

Call recover() to go back in the Runtime state.

vpMatrix Task::jacobianFromExpectedInputs ( const visp::expectedInputs expected_inputs) const
protected

Take the expected inputs and set the jacobian matrix for the controller

Parameters
Expectedinputs for the setpoint with wrt body frame
Returns
Jacobian matrix
bool Task::readCorners ( Points corners,
std::string const &  desired_target 
)
protected

Read the input port and select among the VisualFeaturePoint vector the one who was the same identifier as "desired_target". Then update it features and return the corners of the desired target.

Parameters
vectorof corners
desiredtarget identifier
Returns
true if the corners could be retrieved, false if the desired target was not detected.
bool Task::readSetpoint ( base::LinearAngular6DCommand &  setpoint)
protected

Read the setpoint input port.

Parameters
Setpoint.Body position in the object frame
Returns
True if there is any setpoint available, false if the input port was never writen
bool Task::setDesired_target ( std::string const &  value)
protectedvirtual

Update the dynamic property "desired_target"

Parameters
stringcontaining the desired target's identifier
void Task::setGain ( double  gain,
visp::adaptiveGains const &  adaptive_gains,
bool  use_adaptive 
)
protected

Set the controller gain

Parameters
staticgain
adaptivegains value
setthe adaptive gains if true. If false, use the static gain instead.
void Task::setObjectSize ( double  object_width,
double  object_height 
)
protected

Set the objetc size

Parameters
targetwidth
targetheight
bool Task::startHook ( )

This hook is called by Orocos when the state machine transitions from Stopped to Running. If it returns false, then the component will stay in Stopped. Otherwise, it goes into Running and updateHook() will be called.

void Task::stopHook ( )

This hook is called by Orocos when the state machine transitions from Running to Stopped after stop() has been called.

vpHomogeneousMatrix Task::updateDesiredPose ( base::LinearAngular6DCommand  setpoint)
protected

Update the desired pose according to a setpoint. The setpoint is the desired object pose in the vehicle's frame.

Parameters
Desiredbody position with resepct to the visual feature
Returns
The desired pose of the object in the camera frame
void Task::updateFeaturesHVS ( Points const &  corners,
vpHomogeneousMatrix const &  cdMo 
)
protected

Update the visual features of a hibrid visual controller.

Parameters
detectedcorners
desiredobject pose in the camera frame

Update Feature 1 - p

Update Feature 2 - depth

Update Feature 3 - t, tu

void Task::updateHook ( )

This hook is called by Orocos when the component is in the Running state, at each activity step. Here, the activity gives the "ticks" when the hook should be called.

The error(), exception() and fatal() calls, when called in this hook, allow to get into the associated RunTimeError, Exception and FatalError states.

In the first case, updateHook() is still called, and recover() allows you to go back into the Running state. In the second case, the errorHook() will be called instead of updateHook(). In Exception, the component is stopped and recover() needs to be called before starting it again. Finally, FatalError cannot be recovered.

void Task::updateTargetParameters ( std::string const &  desired_target)
protected

Look for the parameters of a target in a given target list and update it. An exception is raised if there is no desired_target in the target list.

Parameters
target'sname
void Task::writeVelocities ( vpColVector const &  v)
protected

Write the computed velocities to the output port

Parameters
computedvelocities

Friends And Related Function Documentation

friend class TaskBase
friend

Member Data Documentation

vpCameraParameters visp::Task::cam_cal
protected
vpHomogeneousMatrix visp::Task::cMb
protected
visp::controllerState visp::Task::ctrl_state
protected
vpVelocityTwistMatrix visp::Task::cVb
protected
vpFeatureDepth visp::Task::depth
protected
std::string visp::Task::desired_target
protected
vpMatrix visp::Task::eJe
protected
visp::expectedInputs visp::Task::expected_inputs
protected
vpPoint visp::Task::P
protected
vpFeaturePoint visp::Task::p
protected
vpFeaturePoint visp::Task::pd
protected
vpPoint visp::Task::point[4]
protected
double visp::Task::rotation_around_z
protected
base::LinearAngular6DCommand visp::Task::setpoint
protected
vpFeatureTranslation visp::Task::t
protected
std::vector<visp::targetObjectParameters> visp::Task::target_list
protected
vpServo visp::Task::task
protected
vpFeatureThetaU visp::Task::tu
protected
double visp::Task::Zd
protected

The documentation for this class was generated from the following files: