RobWorkProject  23.9.11-
Public Types | Public Slots | Public Member Functions | Protected Member Functions | List of all members
RobWorkStudio Class Reference

main robwork studio class More...

#include <RobWorkStudio.hpp>

Inherits QMainWindow.

Public Types

typedef rw::core::Ptr< RobWorkStudioPtr
 
typedef boost::function< void(const rw::kinematics::State &)> StateChangedListener
 Defines a state changed listener. More...
 
typedef rw::core::Event< StateChangedListener, const rw::kinematics::State & > StateChangedEvent
 Defines event for state changes. More...
 
typedef boost::function< void(rw::kinematics::Frame *)> FrameSelectedListener
 Defines a frame selected listener. More...
 
typedef rw::core::Event< FrameSelectedListener, rw::kinematics::Frame * > FrameSelectedEvent
 Defines event for frame selection. More...
 
typedef boost::function< void(const std::string &)> GenericEventListener
 Defines a generic event listener. More...
 
typedef rw::core::Event< GenericEventListener, const std::string & > GenericEvent
 Defines event for generic user events.
 
typedef boost::function< void(const std::string &, boost::any)> GenericAnyEventListener
 Defines a generic event listener with data. More...
 
typedef rw::core::Event< GenericAnyEventListener, const std::string &, boost::any > GenericAnyEvent
 Defines event for generic user events.
 
typedef boost::function< void(int, Qt::KeyboardModifiers)> KeyEventListener
 Defines a key pressed event listener. More...
 
typedef rw::core::Event< KeyEventListener, int, Qt::KeyboardModifiers > KeyEvent
 Defines event for key pressed events.
 
typedef boost::function< void(QMouseEvent *)> MousePressedEventListener
 Defines a Mouse pressed event Listeners are called when someone fires a MousePressed event. MousePressedEventListener defines the signature of a callback method. Example usage in a plugin: See RobWorkStudio::StateChangedListener.
 
typedef rw::core::Event< MousePressedEventListener, QMouseEvent * > MousePressedEvent
 Defines event for mouse pressed events.
 
typedef boost::function< void(const rw::trajectory::TimedStatePath &)> StateTrajectoryChangedListener
 Defines a StateTrajectory changed event Listeners are called when someone fires a stateTrajectoryChanged event. StateTrajectoryListener defines the signature of a callback method. Example usage in a plugin: See RobWorkStudio::StateChangedListener.
 
typedef rw::core::Event< StateTrajectoryChangedListener, const rw::trajectory::TimedStatePath & > StateTrajectoryChangedEvent
 Defines event for key pressed events.
 
typedef boost::function< void(const rw::trajectory::TimedStatePath::Ptr)> StateTrajectoryPtrChangedListener
 Defines a StateTrajectory changed event Listeners are called when someone fires a stateTrajectoryChanged event. StateTrajectoryListener defines the signature of a callback method. Example usage in a plugin: See RobWorkStudio::StateChangedListener.
 
typedef rw::core::Event< StateTrajectoryPtrChangedListener, const rw::trajectory::TimedStatePath::PtrStateTrajectoryPtrChangedEvent
 Defines event for key pressed events.
 
typedef boost::function< void(const rw::math::Vector3D<> &)> PositionSelectedListener
 Defines a listener for position change events. More...
 
typedef rw::core::Event< PositionSelectedListener, const rw::math::Vector3D<> & > PositionSelectedEvent
 Defines event for PositionChanged.
 

Public Slots

void setTStatePath (rw::trajectory::TimedStatePath path)
 Slot for changing the common timed state path. More...
 

Public Member Functions

 RobWorkStudio (const rw::core::PropertyMap &map)
 RobWorkStudio object with a number of plugins loaded elsewhere.
 
 ~RobWorkStudio ()
 destructor More...
 
void openFile (const std::string &filename)
 Opens either a workcell file, device file or a CAD file. Supported formats are STL, STLA, STLB, 3DS, AC, AC3D, TRI, OBJ, WU, WC, DEV, XML. More...
 
rw::core::PropertyMapgetPropertyMap ()
 returns the property map of this instance of robwork studio More...
 
void setWorkcell (rw::models::WorkCell::Ptr workcell)
 sets the workcell of robwork studio. If another workcell is currently loaded it will be closed. More...
 
void setWorkCell (rw::models::WorkCell::Ptr workcell)
 sets the workcell of robwork studio. If another workcell is currently loaded it will be closed. More...
 
void setWorkcell (std::string workcell_file)
 sets the workcell of robwork studio. If another workcell is currently loaded it will be closed. More...
 
void setWorkCell (std::string workcell_file)
 sets the workcell of robwork studio. If another workcell is currently loaded it will be closed. More...
 
void closeWorkCell ()
 close the workcell
 
void postWorkCell (rw::models::WorkCell::Ptr workcell)
 sets the workcell of robwork studio. If another workcell is currently loaded it will be closed. More...
 
void postOpenWorkCell (const std::string &string)
 Request loading of a new workcell. Use this if request comes from non-GUI thread. More...
 
void postCloseWorkCell ()
 Request closing a workcell. Use this if request comes from non-GUI thread.
 
rw::models::WorkCell::Ptr getWorkcell ()
 Returns the workcell opened in RobWorkStudio. More...
 
rw::models::WorkCell::Ptr getWorkCell ()
 Returns the workcell opened in RobWorkStudio. More...
 
rw::proximity::CollisionDetector::Ptr getCollisionDetector ()
 Returns the collision detector used in the user interface. More...
 
rw::graphics::WorkCellScene::Ptr getWorkCellScene ()
 Returns the component controlling the drawing. More...
 
const rw::trajectory::TimedStatePathgetTimedStatePath ()
 Returns reference to the common TimedStatePath. More...
 
const rw::core::Ptr< rw::trajectory::TimedStatePathgetTimedStatePathPtr ()
 Returns pointer to the common TimedStatePath. More...
 
void setTimedStatePath (const rw::trajectory::TimedStatePath &path)
 Sets the common TimedStatePath. More...
 
void setTimedStatePath (const rw::trajectory::TimedStatePath::Ptr path)
 Sets the common TimedStatePath. More...
 
void postTimedStatePath (const rw::trajectory::TimedStatePath &path)
 Sets the common TimedStatePath. More...
 
void postTimedStatePath (const rw::trajectory::TimedStatePath::Ptr &path)
 Sets the common TimedStatePath. More...
 
void postExit ()
 Request program termination.
 
void setState (const rw::kinematics::State &state)
 Sets the current state of for RobWorkStudio. More...
 
void postState (const rw::kinematics::State &state)
 Sets the current state of for RobWorkStudio. More...
 
void postUpdateAndRepaint ()
 a method for updating the opengl graphics output More...
 
void postSaveViewGL (const std::string &str)
 Saves the current opengl view. More...
 
void postGenericEvent (const std::string &id)
 Post a generic event. More...
 
void postGenericAnyEvent (const std::string &id, boost::any data)
 Post a generic event. More...
 
const rw::kinematics::StategetState ()
 Returns the current state. More...
 
rw::core::Loglog ()
 the log of RobWorkStudio. More...
 
rw::core::Log::Ptr logPtr ()
 the log of RobWorkStudio. More...
 
bool event (QEvent *event)
 Handle an event. More...
 
StateChangedEventstateChangedEvent ()
 Returns StateChangeEvent needed for subscribing and firing the event. More...
 
FrameSelectedEventframeSelectedEvent ()
 Returns FrameSelectedEvent needed for subscription and firing of events. More...
 
GenericEventgenericEvent ()
 Returns GenericEvent needed for subscription and firing of events. More...
 
GenericAnyEventgenericAnyEvent ()
 a generic event like GenericEvent but with the possibility of attaching any data to the event message. More...
 
boost::any waitForAnyEvent (const std::string &id, double timeout=-1.0)
 this will block until an anyevent with id id is emitted or timeout is reached. More...
 
KeyEventkeyEvent ()
 Returns KeyEvent needed for subscription and firing of events. More...
 
MousePressedEventmousePressedEvent ()
 Returns MousePressedEvent needed for subscription and firing of events. More...
 
StateTrajectoryChangedEventstateTrajectoryChangedEvent ()
 Returns stateTrajectoryChangedEvent needed for subscription and firing of event. More...
 
StateTrajectoryPtrChangedEventstateTrajectoryPtrChangedEvent ()
 Returns stateTrajectoryChangedEvent needed for subscription and firing of event. More...
 
PositionSelectedEventpositionSelectedEvent ()
 Returns PositionChangedEvent object needed for subscription to and firing of event. More...
 
void saveViewGL (const QString &filename)
 Saves the current opengl view. More...
 
void updateAndRepaint ()
 a method for updating the opengl graphics output
 
RWStudioView3D::Ptr getView ()
 Returns the instance of the ViewGL class.
 
rw::math::Transform3D getViewTransform ()
 Returns the current view transform. More...
 
void setViewTransform (rw::math::Transform3D<> nviewT3D)
 Sets current view transform. More...
 
void keyPressEvent (QKeyEvent *e)
 Handles a Qt key event. More...
 
AboutBoxgetAboutBox ()
 
void propertyChangedListener (rw::core::PropertyBase *base)
 Handles changed properties. More...
 
void addPlugin (RobWorkStudioPlugin *plugin, bool visible, Qt::DockWidgetArea area=Qt::LeftDockWidgetArea)
 Add a plugin. More...
 
const std::vector< RobWorkStudioPlugin * > & getPlugins () const
 Get the list of currently loaded plugins. More...
 
void loadSettingsSetupPlugins (const std::string &file)
 Restore the RobWorkStudio settings from a file. More...
 
void loadPlugin (std::string pluginFile, bool visible=false, int dock=1)
 Load a plugin file. More...
 
bool unloadPlugin (RobWorkStudioPlugin *pl)
 Unload the plugin from RobWorkStudio. More...
 
std::string loadSettingsWorkcell (const std::string &file)
 Load Workcell into RobWork Studio based on settings file. More...
 
rw::core::PropertyMapgetSettings ()
 Get the current RobWorkStudio settings. More...
 

Protected Member Functions

void closeEvent (QCloseEvent *e)
 Close Event inherited from QT.
 

Detailed Description

main robwork studio class

Member Typedef Documentation

◆ FrameSelectedEvent

Defines event for frame selection.

The selected rw::kinematics::Frame* is provided as an argument

◆ FrameSelectedListener

typedef boost::function<void(rw::kinematics::Frame*)> FrameSelectedListener

Defines a frame selected listener.

Listeners to this event is calls when a frame is selected.

FrameSelectedListener describes the signature of the callback method.

Example usage in a plugin, see RobWorkStudio::StateChangedListener

◆ GenericAnyEventListener

typedef boost::function<void(const std::string&, boost::any)> GenericAnyEventListener

Defines a generic event listener with data.

Listeners to this event is called when someone fires a generic event with data.

GenericAnyEventListener describes the signature of a callback method, used for generic (user defined) event containing a string message and data.

◆ GenericEventListener

typedef boost::function<void(const std::string&)> GenericEventListener

Defines a generic event listener.

Listeners to this event is called when someone fires a generic event.

GenericEventListener describes the signature of a callback method, used for generic (user defined) event containing a string message.

Example usage in a plugin, see RobWorkStudio::StateChangedListener

◆ KeyEventListener

typedef boost::function<void(int, Qt::KeyboardModifiers)> KeyEventListener

Defines a key pressed event listener.

Listeners are called when someone fires keyEvent. By default the View component fires out all key events it receives from QT.

KeyEventListener describes the signature of a callback method.

Example usage in a plugin:

void MyPlugin::initialize() {
getRobWorkStudio()->keyEvent().add(
boost::bind(&MyPlugin::keyListener, this, _1, _2), this);
}
void MyPlugin::keyListener(int key, Qt::KeyboardModifiers modifiers) {
...
}

◆ PositionSelectedListener

typedef boost::function<void(const rw::math::Vector3D<>&)> PositionSelectedListener

Defines a listener for position change events.

These listeners are called when user has selected a point in the 3D view.

To send an event double clicking left mouse button on the point of interest while pressing shift.

Example use in a plugin: See RobWorkStudio::StateChangedListener

◆ StateChangedEvent

Defines event for state changes.

This event is fired when setState is called, or when a user (plugin) manually calls fire.

◆ StateChangedListener

typedef boost::function<void(const rw::kinematics::State&)> StateChangedListener

Defines a state changed listener.

Listeners to this event is called when a change of the state occurs.

StateChangedListener describes the signature of a callback method.

Example usage in a plugin:

void MyPlugin::initialize()
{
getRobWorkStudio()->stateChangedEvent().add(
boost::bind(&MyPlugin::stateChangedListener, this, _1), this);
}
void MyPlugin::stateChangedListener(const State& state)
{
...
}

Constructor & Destructor Documentation

◆ ~RobWorkStudio()

destructor

Returns

Member Function Documentation

◆ addPlugin()

void addPlugin ( RobWorkStudioPlugin plugin,
bool  visible,
Qt::DockWidgetArea  area = Qt::LeftDockWidgetArea 
)

Add a plugin.

Parameters
plugin[in/out] the plugin.
visible[in] true if the plugin should be visible.
area[in] the area for the widget.

◆ event()

bool event ( QEvent *  event)

Handle an event.

Parameters
event[in] the Qt event.
Returns
true if handled, false otherwise.

◆ frameSelectedEvent()

FrameSelectedEvent& frameSelectedEvent ( )
inline

Returns FrameSelectedEvent needed for subscription and firing of events.

Returns
Reference to the FrameSelectedEvent

◆ genericAnyEvent()

GenericAnyEvent& genericAnyEvent ( )
inline

a generic event like GenericEvent but with the possibility of attaching any data to the event message.

Returns
Reference to the GenericAnyEvent

◆ genericEvent()

GenericEvent& genericEvent ( )
inline

Returns GenericEvent needed for subscription and firing of events.

Returns
Reference to the GenericEvent

◆ getAboutBox()

AboutBox* getAboutBox ( )
inline
Returns
Returns the about box for RobWorkStudio

Plugins can add their own tab to the about box.

◆ getCollisionDetector()

rw::proximity::CollisionDetector::Ptr getCollisionDetector ( )
inline

Returns the collision detector used in the user interface.

The method provides a pointer to the collision checker used in the user interface.

Returns
CollisionDetector

◆ getPlugins()

const std::vector<RobWorkStudioPlugin*>& getPlugins ( ) const
inline

Get the list of currently loaded plugins.

Returns
A reference to the vector of plugin pointers.

◆ getPropertyMap()

rw::core::PropertyMap& getPropertyMap ( )
inline

returns the property map of this instance of robwork studio

Returns
propertymap

◆ getSettings()

rw::core::PropertyMap& getSettings ( )
inline

Get the current RobWorkStudio settings.

Returns
a reference to the settings.

◆ getState()

const rw::kinematics::State& getState ( )
inline

Returns the current state.

Returns the current state of the workcell

Returns
Current state

◆ getTimedStatePath()

const rw::trajectory::TimedStatePath& getTimedStatePath ( )
inline

Returns reference to the common TimedStatePath.

The TimedStatePath can be used to represent a trajectory represented by full workcell states

Returns
Reference to TimedStatePath

◆ getTimedStatePathPtr()

const rw::core::Ptr<rw::trajectory::TimedStatePath> getTimedStatePathPtr ( )
inline

Returns pointer to the common TimedStatePath.

The TimedStatePath can be used to represent a trajectory represented by full workcell states

Returns
pointer to TimedStatePath

◆ getViewTransform()

rw::math::Transform3D getViewTransform ( )
inline

Returns the current view transform.

Convenience function.

◆ getWorkcell()

rw::models::WorkCell::Ptr getWorkcell ( )

Returns the workcell opened in RobWorkStudio.

Returns
the workcell.

◆ getWorkCell()

rw::models::WorkCell::Ptr getWorkCell ( )
inline

Returns the workcell opened in RobWorkStudio.

Returns
the workcell.

◆ getWorkCellScene()

rw::graphics::WorkCellScene::Ptr getWorkCellScene ( )
inline

Returns the component controlling the drawing.

Through the WorkCellGLDrawer the user can control the geometry associated to frames.

◆ keyEvent()

KeyEvent& keyEvent ( )
inline

Returns KeyEvent needed for subscription and firing of events.

Returns
Reference to the KeyEvent

◆ keyPressEvent()

void keyPressEvent ( QKeyEvent *  e)

Handles a Qt key event.

Parameters
e[in] the event.

◆ loadPlugin()

void loadPlugin ( std::string  pluginFile,
bool  visible = false,
int  dock = 1 
)

Load a plugin file.

Parameters
pluginFile[in] The absolute path to the shared library file contaning the object
visible[in] Sets wether the plugin is UI is opened upon load
dock[in] The area where the uis will be placed

◆ loadSettingsSetupPlugins()

void loadSettingsSetupPlugins ( const std::string &  file)

Restore the RobWorkStudio settings from a file.

Parameters
file[in] the filename.

◆ loadSettingsWorkcell()

std::string loadSettingsWorkcell ( const std::string &  file)

Load Workcell into RobWork Studio based on settings file.

Parameters
file[in] the filename.
Returns
workcell file path

◆ log()

rw::core::Log& log ( )

the log of RobWorkStudio.

Returns
a reference to the log.

◆ logPtr()

rw::core::Log::Ptr logPtr ( )

the log of RobWorkStudio.

Returns
a smart pointer to the log.

◆ mousePressedEvent()

MousePressedEvent& mousePressedEvent ( )
inline

Returns MousePressedEvent needed for subscription and firing of events.

Returns
Reference to the MousePressedEvent

◆ openFile()

void openFile ( const std::string &  filename)

Opens either a workcell file, device file or a CAD file. Supported formats are STL, STLA, STLB, 3DS, AC, AC3D, TRI, OBJ, WU, WC, DEV, XML.

Parameters
filename[in] name of file

◆ positionSelectedEvent()

PositionSelectedEvent& positionSelectedEvent ( )
inline

Returns PositionChangedEvent object needed for subscription to and firing of event.

Returns
Reference to the PositionSelectedEvent

◆ postGenericAnyEvent()

void postGenericAnyEvent ( const std::string &  id,
boost::any  data 
)

Post a generic event.

Parameters
id[in] identifier for the event.
data[in] the data for the event.

◆ postGenericEvent()

void postGenericEvent ( const std::string &  id)

Post a generic event.

Parameters
id[in] identifier for the event.

◆ postOpenWorkCell()

void postOpenWorkCell ( const std::string &  string)

Request loading of a new workcell. Use this if request comes from non-GUI thread.

Parameters
string[in] the filename.

◆ postSaveViewGL()

void postSaveViewGL ( const std::string &  str)

Saves the current opengl view.

The filename should end with either ".png", ".jpg" or ".bmp" to specify the format used to save the file.

This function can be called from other threads.

◆ postState()

void postState ( const rw::kinematics::State state)

Sets the current state of for RobWorkStudio.

Sets the current state and calls all StateChanged listeners

Parameters
state[in] The new state

This function can be called from other threads.

◆ postTimedStatePath() [1/2]

void postTimedStatePath ( const rw::trajectory::TimedStatePath path)

Sets the common TimedStatePath.

Use the common TimedStatePath to set at trajectory, which plugins, e.g. PlayBack should have access to.

Parameters
path[in] The new TimedStatePath

Use this version if request comes from non-GUI thread.

◆ postTimedStatePath() [2/2]

void postTimedStatePath ( const rw::trajectory::TimedStatePath::Ptr path)

Sets the common TimedStatePath.

Use the common TimedStatePath to set at trajectory, which plugins, e.g. PlayBack should have access to.

Parameters
path[in] The new TimedStatePath

Use this version if request comes from non-GUI thread.

◆ postUpdateAndRepaint()

void postUpdateAndRepaint ( )

a method for updating the opengl graphics output

This function can be called from other threads.

◆ postWorkCell()

void postWorkCell ( rw::models::WorkCell::Ptr  workcell)

sets the workcell of robwork studio. If another workcell is currently loaded it will be closed.

Parameters
workcell[in] the workcell

Use this if request comes from non-GUI thread.

◆ propertyChangedListener()

void propertyChangedListener ( rw::core::PropertyBase base)

Handles changed properties.

Parameters
base[in] the changed property.

◆ saveViewGL()

void saveViewGL ( const QString &  filename)

Saves the current opengl view.

The filename should end with either ".png", ".jpg" or ".bmp" to specify the format used to save the file.

◆ setState()

void setState ( const rw::kinematics::State state)

Sets the current state of for RobWorkStudio.

Sets the current state and calls all StateChanged listeners

Parameters
state[in] The new state

◆ setTimedStatePath() [1/2]

void setTimedStatePath ( const rw::trajectory::TimedStatePath path)

Sets the common TimedStatePath.

Use the common TimedStatePath to set at trajectory, which plugins, e.g. PlayBack should have access to.

Parameters
path[in] The new TimedStatePath

◆ setTimedStatePath() [2/2]

void setTimedStatePath ( const rw::trajectory::TimedStatePath::Ptr  path)

Sets the common TimedStatePath.

Use the common TimedStatePath to set at trajectory, which plugins, e.g. PlayBack should have access to.

Parameters
path[in] The new TimedStatePath

◆ setTStatePath

void setTStatePath ( rw::trajectory::TimedStatePath  path)
slot

Slot for changing the common timed state path.

Parameters
path[in] the path.

◆ setViewTransform()

void setViewTransform ( rw::math::Transform3D<>  nviewT3D)
inline

Sets current view transform.

Convenience function. Performs update & repaint as well.

◆ setWorkcell() [1/2]

void setWorkcell ( rw::models::WorkCell::Ptr  workcell)

sets the workcell of robwork studio. If another workcell is currently loaded it will be closed.

Parameters
workcell[in] the workcell

◆ setWorkCell() [1/2]

void setWorkCell ( rw::models::WorkCell::Ptr  workcell)
inline

sets the workcell of robwork studio. If another workcell is currently loaded it will be closed.

Parameters
workcell[in] the workcell

◆ setWorkcell() [2/2]

void setWorkcell ( std::string  workcell_file)
inline

sets the workcell of robwork studio. If another workcell is currently loaded it will be closed.

Parameters
workcell_file[in] the filename of the workcell

◆ setWorkCell() [2/2]

void setWorkCell ( std::string  workcell_file)
inline

sets the workcell of robwork studio. If another workcell is currently loaded it will be closed.

Parameters
workcell_file[in] the filename of the workcell

◆ stateChangedEvent()

StateChangedEvent& stateChangedEvent ( )
inline

Returns StateChangeEvent needed for subscribing and firing the event.

Returns
Reference to the StateChangedEvent

◆ stateTrajectoryChangedEvent()

StateTrajectoryChangedEvent& stateTrajectoryChangedEvent ( )
inline

Returns stateTrajectoryChangedEvent needed for subscription and firing of event.

Returns
Reference to the stateTrajectoryChangedEvent

◆ stateTrajectoryPtrChangedEvent()

StateTrajectoryPtrChangedEvent& stateTrajectoryPtrChangedEvent ( )
inline

Returns stateTrajectoryChangedEvent needed for subscription and firing of event.

Returns
Reference to the stateTrajectoryChangedEvent

◆ unloadPlugin()

bool unloadPlugin ( RobWorkStudioPlugin pl)

Unload the plugin from RobWorkStudio.

Parameters
pl[in] the plugin to be unloaded
Returns
true if succesfull
false if an error was encountered while unloading

◆ waitForAnyEvent()

boost::any waitForAnyEvent ( const std::string &  id,
double  timeout = -1.0 
)

this will block until an anyevent with id id is emitted or timeout is reached.

Parameters
id[in] string id of the event that is expected
timeout[in] timeout in seconds
Returns

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