RobWorkProject
24.12.4-
|
WorkCell keeps track of devices, obstacles and objects in the scene. More...
#include <WorkCell.hpp>
Public Types | |
enum | WorkCellEventType { STATE_DATA_ADDED , STATE_DATA_REMOVED , WORKCELL_CHANGED } |
WorkCell Event Types. More... | |
typedef rw::core::Ptr< WorkCell > | Ptr |
Smart pointer type to a WorkCell object. | |
typedef rw::core::Ptr< const WorkCell > | CPtr |
Smart pointer type to a constant WorkCell object. | |
typedef boost::function< void(int)> | WorkCellChangedListener |
Definition of work cell changed listener. | |
typedef rw::core::Event< WorkCellChangedListener, int > | WorkCellChangedEvent |
Definition of even for work cell changed. | |
Public Member Functions | |
WorkCell (const std::string &name) | |
Constructs an empty WorkCell. More... | |
WorkCell (rw::core::Ptr< rw::kinematics::StateStructure > tree, const std::string &name="", const std::string &filename="") | |
Constructs a WorkCell. More... | |
~WorkCell () | |
std::string | getName () const |
The name of the workcell or the empty string if no name was provided. More... | |
rw::kinematics::Frame * | getWorldFrame () const |
Returns pointer to the world frame. More... | |
void | addFrame (rw::kinematics::Frame *frame, rw::kinematics::Frame *parent=NULL) |
Adds frame with parent as parent. More... | |
void | addFrame (rw::core::Ptr< rw::kinematics::Frame > frame, rw::core::Ptr< rw::kinematics::Frame > parent=NULL) |
Adds frame with parent as parent. More... | |
void | addDAF (rw::kinematics::Frame *frame, rw::kinematics::Frame *parent=NULL) |
Adds dynamically attachable frame (DAF) frame with parent as parent. More... | |
void | addDAF (rw::core::Ptr< rw::kinematics::Frame > frame, rw::core::Ptr< rw::kinematics::Frame > parent=NULL) |
Adds dynamically attachable frame (DAF) frame with parent as parent. More... | |
void | remove (rw::core::Ptr< rw::kinematics::Frame > frame) |
Removes frame from work cell. More... | |
void | remove (rw::kinematics::Frame *frame) |
Removes frame from work cell. More... | |
void | removeObject (Object *object) |
Removes object from workcell. More... | |
void | addDevice (rw::core::Ptr< rw::models::Device > device) |
Adds a Device to the WorkCell. More... | |
const std::vector< rw::core::Ptr< rw::models::Device > > & | getDevices () const |
Returns a reference to a vector with pointers to the Device(s) in the WorkCell. More... | |
rw::kinematics::Frame * | findFrame (const std::string &name) const |
Returns frame with the specified name. More... | |
template<class T > | |
T * | findFrame (const std::string &name) const |
Returns frame with the specified name and type T. More... | |
template<class T > | |
std::vector< T * > | findFrames () const |
Returns all frames of a specific type T. More... | |
std::vector< rw::kinematics::Frame * > | getFrames () const |
Returns all frames in workcell. More... | |
rw::core::Ptr< rw::models::Device > | findDevice (const std::string &name) const |
The device named name of the workcell. More... | |
template<class T > | |
rw::core::Ptr< T > | findDevice (const std::string &name) const |
The device named name of the workcell. More... | |
template<class T > | |
std::vector< rw::core::Ptr< T > > | findDevices () const |
Returns a vector with pointers to the Device(s) with a specific type T in the WorkCell. More... | |
rw::kinematics::State | getDefaultState () const |
Returns a default State. More... | |
void | setDefaultState (const rw::kinematics::State &state) |
set the default state of the WorkCell. if the given state is an older state then states valid in both new and old version will be copied to the default state. | |
rw::core::Ptr< rw::sensor::SensorModel > | findSensor (const std::string &name) const |
Returns sensor with the specified name. More... | |
template<class T > | |
rw::core::Ptr< T > | findSensor (const std::string &name) const |
Returns sensor with the specified name and type T. More... | |
template<class T > | |
std::vector< rw::core::Ptr< T > > | findSensors () const |
Returns all frames of a specific type T. More... | |
std::vector< rw::core::Ptr< rw::sensor::SensorModel > > | getSensors () const |
Returns all frames in workcell. More... | |
rw::core::Ptr< rw::models::ControllerModel > | findController (const std::string &name) const |
Returns controller with the specified name. More... | |
template<class T > | |
rw::core::Ptr< T > | findController (const std::string &name) const |
Returns controller with the specified name and type T. More... | |
template<class T > | |
std::vector< rw::core::Ptr< T > > | findControllers () const |
Returns all controllers of a specific type T. | |
std::vector< rw::core::Ptr< ControllerModel > > | getControllers () const |
Returns all controllers in workcell. More... | |
std::vector< rw::core::Ptr< Object > > | getObjects () const |
Returns all object in the work cell. More... | |
rw::core::Ptr< Object > | findObject (const std::string &name) const |
The object named name of the workcell. More... | |
void | add (rw::core::Ptr< rw::models::Device > device) |
Add device to workcell. | |
void | add (rw::core::Ptr< Object > object) |
Add object to workcell. | |
void | add (rw::core::Ptr< rw::sensor::SensorModel > sensor) |
Add sensormodel to workcell. | |
void | add (rw::core::Ptr< ControllerModel > controller) |
Add controllermodel to workcell. | |
void | remove (rw::core::Ptr< Object > object) |
Remove object from workcell. | |
void | remove (rw::core::Ptr< rw::models::Device > device) |
Remove device from workcell. | |
void | remove (rw::core::Ptr< rw::sensor::SensorModel > sensor) |
Remove sensormodel from workcell. | |
void | remove (rw::core::Ptr< ControllerModel > controller) |
Remove controllermodel from workcell. | |
rw::core::Ptr< rw::kinematics::StateStructure > | getStateStructure () |
gets the complete state structure of the workcell. More... | |
WorkCellChangedEvent & | workCellChangedEvent () |
Returns the work cell changed event. More... | |
rw::core::PropertyMap & | getPropertyMap () |
Properties of this workcell. | |
const rw::core::PropertyMap & | getPropertyMap () const |
Properties of this workcell. More... | |
rw::proximity::CollisionSetup | getCollisionSetup () |
Returns collision setup associated to work cell. More... | |
rw::core::Ptr< rw::graphics::SceneDescriptor > | getSceneDescriptor () |
Get the scene descriptor. More... | |
void | setSceneDescriptor (rw::core::Ptr< rw::graphics::SceneDescriptor > scene) |
Set the scene descriptor. More... | |
std::string | getFilename () const |
Returns the full path and filename of the workcell. More... | |
std::string | getFilePath () const |
Returns the path of where the work cell is located. More... | |
const std::string & | getCalibrationFilename () const |
Returns the filename of the calibration associated to the work cell. More... | |
void | setCalibrationFilename (const std::string &calibrationFilename) |
Sets the filename of the calibration file. More... | |
WorkCell keeps track of devices, obstacles and objects in the scene.
WorkCell is a pretty dumb container to which you can add your devices and the frames you your GUI to show as objects or camera views.
WorkCell is responsible for keeping track of everything including all devices, object and obstacles in the environment. WorkCell contains the World Frame, which represents the root and the only frame without a parent.
enum WorkCellEventType |
WorkCell Event Types.
Enumerator | |
---|---|
STATE_DATA_ADDED | StateData was added to state structure. |
STATE_DATA_REMOVED | StateData was removed from state structure. |
WORKCELL_CHANGED | WorkCell changed (such as addition or removal of Device, Frame, Object, SensorModel, or ControllerModel). |
WorkCell | ( | const std::string & | name | ) |
Constructs an empty WorkCell.
name | [in] The name of the workcell. A good name for the workcell would be the (eventual) file that the workcell was loaded from. |
WorkCell | ( | rw::core::Ptr< rw::kinematics::StateStructure > | tree, |
const std::string & | name = "" , |
||
const std::string & | filename = "" |
||
) |
~WorkCell | ( | ) |
Destroys a work cell including the devices that have been added.
Management of the frames is done by a tree of which the work cell knows nothing. Therefore if this kinematics tree is still in existence (which it probably is), then the frames that used to be accessible via this work cell will still be valid.
void addDAF | ( | rw::core::Ptr< rw::kinematics::Frame > | frame, |
rw::core::Ptr< rw::kinematics::Frame > | parent = NULL |
||
) |
Adds dynamically attachable frame (DAF) frame with parent as parent.
If parent == NULL, then world is used as parent
frame | [in] Frame to add |
parent | [in] Parent frame - uses World is parent == NULL |
void addDAF | ( | rw::kinematics::Frame * | frame, |
rw::kinematics::Frame * | parent = NULL |
||
) |
Adds dynamically attachable frame (DAF) frame with parent as parent.
If parent == NULL, then world is used as parent
frame | [in] Frame to add |
parent | [in] Parent frame - uses World is parent == NULL |
void addDevice | ( | rw::core::Ptr< rw::models::Device > | device | ) |
void addFrame | ( | rw::core::Ptr< rw::kinematics::Frame > | frame, |
rw::core::Ptr< rw::kinematics::Frame > | parent = NULL |
||
) |
Adds frame with parent as parent.
If parent == NULL, then world is used as parent
frame | [in] Frame to add |
parent | [in] Parent frame - uses World is parent == NULL |
void addFrame | ( | rw::kinematics::Frame * | frame, |
rw::kinematics::Frame * | parent = NULL |
||
) |
Adds frame with parent as parent.
If parent == NULL, then world is used as parent
frame | [in] Frame to add |
parent | [in] Parent frame - uses World is parent == NULL |
rw::core::Ptr<rw::models::ControllerModel> findController | ( | const std::string & | name | ) | const |
Returns controller with the specified name.
If multiple controlelrs has the same name, the first controller encountered will be returned. If no controller is found, the method returns NULL.
name | [in] name of controller. |
|
inline |
Returns controller with the specified name and type T.
name | [in] name of controller. |
rw::core::Ptr<rw::models::Device> findDevice | ( | const std::string & | name | ) | const |
The device named name of the workcell.
NULL is returned if there is no such device.
name | [in] The device name |
|
inline |
The device named name of the workcell.
NULL is returned if there is no such device or if the device is not of type T.
name | [in] The workcell name |
|
inline |
Returns a vector with pointers to the Device(s) with a specific type T in the WorkCell.
rw::kinematics::Frame* findFrame | ( | const std::string & | name | ) | const |
Returns frame with the specified name.
If multiple frames has the same name, the first frame encountered will be returned. If no frame is found, the method returns NULL.
name | [in] name of Frame. |
|
inline |
Returns frame with the specified name and type T.
If multiple frames has the same name, the first frame encountered will be returned. If no frame is found, the method returns NULL. if a frame is found and it is nt of type T then NULL is returned.
name | [in] name of Frame. |
|
inline |
Returns all frames of a specific type T.
rw::core::Ptr<Object> findObject | ( | const std::string & | name | ) | const |
The object named name of the workcell.
NULL is returned if there is no such object.
name | [in] The object name |
rw::core::Ptr<rw::sensor::SensorModel> findSensor | ( | const std::string & | name | ) | const |
Returns sensor with the specified name.
If multiple sensors has the same name, the first sensor encountered will be returned. If no sensor is found, the method returns NULL.
name | [in] name of sensor. |
|
inline |
Returns sensor with the specified name and type T.
If multiple sensors has the same name, the first sensor encountered will be returned. If no sensor is found, the method returns NULL. if a sensor is found and it is nt of type T then NULL is returned.
name | [in] name of sensor. |
|
inline |
Returns all frames of a specific type T.
const std::string& getCalibrationFilename | ( | ) | const |
Returns the filename of the calibration associated to the work cell.
Returns an empty string in case no calibration is associated.
To load the file use the getFilePath()+getCalibrationFilename() to get the absolute location
rw::proximity::CollisionSetup getCollisionSetup | ( | ) |
Returns collision setup associated to work cell.
std::vector<rw::core::Ptr<ControllerModel> > getControllers | ( | ) | const |
Returns all controllers in workcell.
rw::kinematics::State getDefaultState | ( | ) | const |
Returns a default State.
const std::vector<rw::core::Ptr<rw::models::Device> >& getDevices | ( | ) | const |
Returns a reference to a vector with pointers to the Device(s) in the WorkCell.
std::string getFilename | ( | ) | const |
Returns the full path and filename of the workcell.
If the workcell is loaded from file, then this method returns the full filename. Otherwise it returns an empty string.
std::string getFilePath | ( | ) | const |
Returns the path of where the work cell is located.
If the workcell is not loaded from file, it returns an empty string
std::vector<rw::kinematics::Frame*> getFrames | ( | ) | const |
Returns all frames in workcell.
|
inline |
The name of the workcell or the empty string if no name was provided.
|
inline |
Returns all object in the work cell.
const rw::core::PropertyMap& getPropertyMap | ( | ) | const |
Properties of this workcell.
|
inline |
Get the scene descriptor.
std::vector<rw::core::Ptr<rw::sensor::SensorModel> > getSensors | ( | ) | const |
Returns all frames in workcell.
|
inline |
gets the complete state structure of the workcell.
rw::kinematics::Frame* getWorldFrame | ( | ) | const |
Returns pointer to the world frame.
void remove | ( | rw::core::Ptr< rw::kinematics::Frame > | frame | ) |
Removes frame from work cell.
frame | [in] Frame to remove |
void remove | ( | rw::kinematics::Frame * | frame | ) |
Removes frame from work cell.
frame | [in] Frame to remove |
void removeObject | ( | Object * | object | ) |
Removes object from workcell.
object | [in] Object to remove |
void setCalibrationFilename | ( | const std::string & | calibrationFilename | ) |
Sets the filename of the calibration file.
calibrationFilename | [in] Filename of calibration file with path relative to the work cell path. |
|
inline |
Set the scene descriptor.
scene | [in] the scene descriptor. |
|
inline |
Returns the work cell changed event.