RobWorkProject
23.9.11-
|
A Controller that use a PD loop to follow a trajectory generated from different target types. If the body is a Kinematic body then the velocities of the body is directly controlled, else wrenches are used to control the body. More...
#include <BodyController.hpp>
Inherits Controller, and SimulatedController.
Public Types | |
typedef rw::core::Ptr< BodyController > | Ptr |
Smart pointer type to this class. | |
Public Types inherited from Controller | |
typedef rw::core::Ptr< Controller > | Ptr |
smart poiner definition for controller | |
Public Types inherited from SimulatedController | |
typedef rw::core::Ptr< SimulatedController > | Ptr |
smart pointer type of this class | |
Public Types inherited from Stateless | |
typedef rw::core::Ptr< Stateless > | Ptr |
Smart pointer type for Stateless. | |
Public Member Functions | |
BodyController (const std::string &name) | |
Construct new controller. More... | |
virtual | ~BodyController () |
Destructor. | |
void | setTarget (rw::core::Ptr< rwsim::dynamics::Body > body, const rw::math::Transform3D<> &target, const rw::kinematics::State &state, double maxLinVel=0.5, double maxLinAcc=1.0, double maxAngVel=0.4, double maxAngAcc=1.0) |
Sets the target transform of a body. The target is defined in world frame. More... | |
void | setTarget (rw::core::Ptr< rwsim::dynamics::Body > body, rw::trajectory::Trajectory< rw::math::Transform3D<>>::Ptr traj) |
Set a target trajectory of a body. The initial configuration of the trajectory must match the current configuration of the body. More... | |
void | setTarget (rw::core::Ptr< rwsim::dynamics::Body > body, const rw::math::VelocityScrew6D<> &velocity) |
Set a velocity target. More... | |
void | setForceTarget (rw::core::Ptr< rwsim::dynamics::Body > body, rw::math::Vector3D<> force, rw::math::Vector3D<> torque) |
Set the force target of a body, the forces will be added such that the force on the body in each timestep will be timestep/[force;torque]. In other words the wrench [force;torque] is stretched over one second. More... | |
rw::math::Transform3D | getTarget (rw::core::Ptr< rwsim::dynamics::Body > body) |
Get the current Cartesian target. More... | |
rw::trajectory::Trajectory< rw::math::Transform3D<> >::Ptr | getTargetTrajectory (rw::core::Ptr< rwsim::dynamics::Body > body) |
Get the current target trajectory for body body. More... | |
void | disableBodyControl (rw::core::Ptr< rwsim::dynamics::Body > body) |
Disable control of a specific body. More... | |
void | disableBodyControl () |
Disable control of all bodies. | |
void | update (const rwlibs::simulation::Simulator::UpdateInfo &info, rw::kinematics::State &state) |
updates/steps the controller with time step dt. It will update the state state accordingly More... | |
void | reset (const rw::kinematics::State &state) |
reset the controller to the applied state More... | |
std::string | getControllerName () |
get the name of this controller More... | |
void | setEnabled (bool enabled) |
disable or enable this controller More... | |
bool | isEnabled () const |
true if this controller is enabled More... | |
rwlibs::control::Controller::Ptr | getControllerHandle (rwlibs::simulation::Simulator::Ptr sim) |
get the controller handle eg. statefull handle, associated with this simulated controller More... | |
Public Member Functions inherited from Controller | |
virtual | ~Controller () |
destructor | |
const std::string & | getName () const |
get the unique name of this controller More... | |
void | setName (const std::string &name) |
set the name of the controller More... | |
Public Member Functions inherited from SimulatedController | |
virtual rw::core::Ptr< rwlibs::control::Controller > | getControllerHandle (rw::core::Ptr< rwlibs::simulation::Simulator > sim)=0 |
get the controller handle eg. statefull handle, associated with this simulated controller More... | |
rw::core::Ptr< rw::models::ControllerModel > | getControllerModel () |
get the controllermodel of this simulated controller More... | |
Public Member Functions inherited from Stateless | |
virtual | ~Stateless () |
destructor | |
virtual void | registerIn (State &state) |
initialize this stateless data to a specific state More... | |
virtual void | registerIn (StateStructure::Ptr state) |
register this stateless object in a statestructure. | |
virtual void | unregister () |
unregisters all state data of this stateless object | |
StateStructure::Ptr | getStateStructure () |
Get the state structure. More... | |
const StateStructure::Ptr | getStateStructure () const |
Get the state structure. More... | |
bool | isRegistered () |
Check if object has registered its state. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Controller | |
Controller (const std::string &name) | |
constructor More... | |
Protected Member Functions inherited from SimulatedController | |
SimulatedController (rw::models::ControllerModel::Ptr model) | |
Constructor. More... | |
Protected Member Functions inherited from Stateless | |
Stateless () | |
constructor | |
template<class T > | |
void | add (StatelessData< T > &data) |
implementations of sensor should add all their stateless data on initialization | |
void | add (StateData *data) |
Add data. More... | |
void | add (rw::core::Ptr< StateData > data) |
implementations of sensor should add all their state data on initialization | |
Protected Attributes inherited from Stateless | |
bool | _registered |
True if object has registered its state. | |
std::vector< rw::core::Ptr< StateData > > | _datas |
Data. | |
StateStructure::Ptr | _stateStruct |
The state structure. | |
A Controller that use a PD loop to follow a trajectory generated from different target types. If the body is a Kinematic body then the velocities of the body is directly controlled, else wrenches are used to control the body.
BodyController | ( | const std::string & | name | ) |
Construct new controller.
name | [in] the name of the controller. |
void disableBodyControl | ( | rw::core::Ptr< rwsim::dynamics::Body > | body | ) |
Disable control of a specific body.
body | [in] the body. |
|
inline |
get the controller handle eg. statefull handle, associated with this simulated controller
|
inlinevirtual |
rw::math::Transform3D getTarget | ( | rw::core::Ptr< rwsim::dynamics::Body > | body | ) |
Get the current Cartesian target.
body | [in] the body for which to get the target |
rw::trajectory::Trajectory<rw::math::Transform3D<> >::Ptr getTargetTrajectory | ( | rw::core::Ptr< rwsim::dynamics::Body > | body | ) |
Get the current target trajectory for body body.
body | [in] body for which to get the target |
|
inlinevirtual |
|
virtual |
reset the controller to the applied state
state | [in] the state to reset to |
Implements SimulatedController.
|
inlinevirtual |
void setForceTarget | ( | rw::core::Ptr< rwsim::dynamics::Body > | body, |
rw::math::Vector3D<> | force, | ||
rw::math::Vector3D<> | torque | ||
) |
Set the force target of a body, the forces will be added such that the force on the body in each timestep will be timestep/[force;torque]. In other words the wrench [force;torque] is stretched over one second.
The wrench is defined in world coordinates.
body | [in] the body. |
force | [in] the force. |
torque | [in] the torque. |
void setTarget | ( | rw::core::Ptr< rwsim::dynamics::Body > | body, |
const rw::math::Transform3D<> & | target, | ||
const rw::kinematics::State & | state, | ||
double | maxLinVel = 0.5 , |
||
double | maxLinAcc = 1.0 , |
||
double | maxAngVel = 0.4 , |
||
double | maxAngAcc = 1.0 |
||
) |
Sets the target transform of a body. The target is defined in world frame.
body | [in] the body to set target for. |
target | [in] the target transformation in world frame. |
state | [in] the state giving the current position. |
maxLinVel | [in] (optional) maximum linear velocity of the body in \(\frac{m}{s}\). |
maxLinAcc | [in] (optional) maximum linear acceleration of the body in \(\frac{m}{s^2}\). |
maxAngVel | [in] (optional) maximum angular velocity of the body in \(\frac{rad}{s}\). |
maxAngAcc | [in] (optional) maximum angular acceleration of the body in \(\frac{rad}{s^2}\). |
void setTarget | ( | rw::core::Ptr< rwsim::dynamics::Body > | body, |
const rw::math::VelocityScrew6D<> & | velocity | ||
) |
Set a velocity target.
body | [in] the body that should move. |
velocity | [in] the velocity target. |
void setTarget | ( | rw::core::Ptr< rwsim::dynamics::Body > | body, |
rw::trajectory::Trajectory< rw::math::Transform3D<>>::Ptr | traj | ||
) |
Set a target trajectory of a body. The initial configuration of the trajectory must match the current configuration of the body.
A Kinematic body will follow the exact path of the trajectory whereas a RigidBody will use a PD controller to follow the trajectory
body | [in] the body that should be moved |
traj | [in] the trajectory. |
|
virtual |
updates/steps the controller with time step dt. It will update the state state accordingly
info | [in] update information related to the time step. |
state | [in/out] the current state |
Implements SimulatedController.