Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CameraManipulator Class Reference

CameraManipulator is a MatrixManipulator which provides a flying camera updating of the camera position & orientation. More...

#include <cameramanipulator.h>

Inheritance diagram for CameraManipulator:
Collaboration diagram for CameraManipulator:

Public Member Functions

 CameraManipulator (osg::Node *node, GlobalData &global, CameraHandle &cameraHandle)
 
virtual const char * className () const
 returns the classname of the manipulator it's NECCESSARY to define this funtion, otherwise the new manipulator WON'T WORK! (but ask me not why) More...
 
virtual void setByMatrix (const osg::Matrixd &matrix)
 set the position of the matrix manipulator using a 4x4 Matrix. More...
 
virtual void setByInverseMatrix (const osg::Matrixd &matrix)
 set the position of the matrix manipulator using a 4x4 Matrix. More...
 
virtual osg::Matrixd getMatrix () const
 get the position of the manipulator as 4x4 Matrix. More...
 
virtual osg::Matrixd getInverseMatrix () const
 get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model view matrix. More...
 
virtual void setNode (osg::Node *)
 is called every time the draw is updated. More...
 
virtual const osg::Node * getNode () const
 
virtual osg::Node * getNode ()
 
virtual void setHome (const osg::Vec3 &eye, const osg::Vec3 &view)
 set the home position of the camera. (and place it there) More...
 
virtual void home (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
 place the camera at its home position More...
 
virtual void init (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
 
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
 
virtual void getUsage (osg::ApplicationUsage &usage) const
 Get the keyboard and mouse usage of this manipulator. More...
 
virtual void update ()
 updates the camera module at every drawstep should be called from the simulation loop More...
 
virtual void manipulateAgent (OsgHandle &osgHandle)
 manipulate agent if Manipulation is active (should be called every simulation step) More...
 
virtual void setWatchedAgent (OdeAgent *agent)
 Sets the agent to be watched with the camera. More...
 
virtual OdeAgentgetWatchedAgent ()
 returns watched agent More...
 
virtual void doOnCallBack (BackCaller *source, BackCaller::CallbackableType type=BackCaller::DEFAULT_CALLBACKABLE_TYPE)
 called if agents list changed More...
 
- Public Member Functions inherited from Callbackable
 Callbackable ()
 
virtual ~Callbackable ()
 

Protected Member Functions

virtual ~CameraManipulator ()
 
virtual void flushMouseEventStack ()
 Reset the internal GUIEvent stack. More...
 
virtual void addMouseEvent (const osgGA::GUIEventAdapter &ea)
 Add the current mouse GUIEvent to internal stack. More...
 
virtual void computeMatrix ()
 
virtual bool calcMovement ()
 For the give mouse movement calculate the movement of the camera. More...
 
virtual bool isWatchingAgentDefined ()
 Checks if an agent is selected and if this agent is available. More...
 
virtual void manageAgents (const int &fkey)
 This manages the robots, switching between them and so on Is normally called from handle(...) More...
 
virtual void calcMovementByAgent ()
 This handles robot movements, so that the camera movemenent is right affected. More...
 
virtual void setHomeViewByAgent ()
 Sets the right view and eye if the robot has changed. More...
 
virtual void setHomeEyeByAgent ()
 
virtual void moveBehindAgent ()
 moves behind the robot which is actually watched More...
 
virtual void centerOnAgent ()
 centers on the robot which is actually watched More...
 
virtual void calcManipulationPointHorizontal (float x, float y)
 manipulates Agent by forces. More...
 
virtual void calcManipulationPointVertical (float x, float y)
 
virtual void calcManipulationPoint (float x, float y)
 

Protected Attributes

osg::ref_ptr< const
osgGA::GUIEventAdapter > 
event_old
 
osg::ref_ptr< const
osgGA::GUIEventAdapter > 
event
 
osg::ref_ptr< osg::Node > node
 
float modelScale
 
osg::Matrixd pose
 
CameraHandlecamHandle
 
GlobalDataglobalData
 
double degreeSmoothness
 
double lengthSmoothness
 
double degreeAccuracy
 
double lengthAccuracy
 

Detailed Description

CameraManipulator is a MatrixManipulator which provides a flying camera updating of the camera position & orientation.

Left mouse button: Pan and tilt Right mouse button: forward and sideways Middle mouse button: up and sideways

It also enables to manipulate agents with forces

Constructor & Destructor Documentation

CameraManipulator ( osg::Node *  node,
GlobalData global,
CameraHandle cameraHandle 
)
~CameraManipulator ( )
protectedvirtual

Member Function Documentation

void addMouseEvent ( const osgGA::GUIEventAdapter &  ea)
protectedvirtual

Add the current mouse GUIEvent to internal stack.

void calcManipulationPoint ( float  x,
float  y 
)
protectedvirtual
void calcManipulationPointHorizontal ( float  x,
float  y 
)
protectedvirtual

manipulates Agent by forces.

The given points are screen coords (-1 to 1) normalized.

void calcManipulationPointVertical ( float  x,
float  y 
)
protectedvirtual
bool calcMovement ( )
protectedvirtual

For the give mouse movement calculate the movement of the camera.

Return true is camera has moved and a redraw is required.

void calcMovementByAgent ( )
protectedvirtual

This handles robot movements, so that the camera movemenent is right affected.

should normally be overwritten by new cameramanipulator

Reimplemented in CameraManipulatorFollow, CameraManipulatorRace, and CameraManipulatorTV.

void centerOnAgent ( )
protectedvirtual

centers on the robot which is actually watched

virtual const char* className ( ) const
inlinevirtual

returns the classname of the manipulator it's NECCESSARY to define this funtion, otherwise the new manipulator WON'T WORK! (but ask me not why)

Reimplemented in CameraManipulatorRace, and CameraManipulatorTV.

void computeMatrix ( )
protectedvirtual
void doOnCallBack ( BackCaller source,
BackCaller::CallbackableType  type = BackCaller::DEFAULT_CALLBACKABLE_TYPE 
)
virtual

called if agents list changed

Implements Callbackable.

void flushMouseEventStack ( )
protectedvirtual

Reset the internal GUIEvent stack.

Matrixd getInverseMatrix ( ) const
virtual

get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model view matrix.

Matrixd getMatrix ( ) const
virtual

get the position of the manipulator as 4x4 Matrix.

const Node * getNode ( ) const
virtual
Node * getNode ( )
virtual
void getUsage ( osg::ApplicationUsage &  usage) const
virtual

Get the keyboard and mouse usage of this manipulator.

OdeAgent * getWatchedAgent ( )
virtual

returns watched agent

bool handle ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  us 
)
virtual
void home ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  us 
)
virtual

place the camera at its home position

void init ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  us 
)
virtual
bool isWatchingAgentDefined ( )
protectedvirtual

Checks if an agent is selected and if this agent is available.

This agent must be listed in the global agent list.

Returns
true if defined, otherwise false
void manageAgents ( const int &  fkey)
protectedvirtual

This manages the robots, switching between them and so on Is normally called from handle(...)

void manipulateAgent ( OsgHandle osgHandle)
virtual

manipulate agent if Manipulation is active (should be called every simulation step)

void moveBehindAgent ( )
protectedvirtual

moves behind the robot which is actually watched

virtual void setByInverseMatrix ( const osg::Matrixd &  matrix)
inlinevirtual

set the position of the matrix manipulator using a 4x4 Matrix.

void setByMatrix ( const osg::Matrixd &  matrix)
virtual

set the position of the matrix manipulator using a 4x4 Matrix.

normally called only when this manipulator is choosed

void setHome ( const osg::Vec3 eye,
const osg::Vec3 view 
)
virtual

set the home position of the camera. (and place it there)

void setHomeEyeByAgent ( )
protectedvirtual

Reimplemented in CameraManipulatorTV.

void setHomeViewByAgent ( )
protectedvirtual

Sets the right view and eye if the robot has changed.

Is called from manageRobots(); should be overwritten by new cameramanipulator (if needed)

Reimplemented in CameraManipulatorFollow, and CameraManipulatorTV.

void setNode ( osg::Node *  node)
virtual

is called every time the draw is updated.

computes the movement of the camera, which is a difference between the desired pos and view and the actual pos and view.

void setWatchedAgent ( OdeAgent agent)
virtual

Sets the agent to be watched with the camera.

Parameters
agentto set
void update ( )
virtual

updates the camera module at every drawstep should be called from the simulation loop

Member Data Documentation

CameraHandle& camHandle
protected
double degreeAccuracy
protected
double degreeSmoothness
protected
osg::ref_ptr<const osgGA::GUIEventAdapter> event
protected
osg::ref_ptr<const osgGA::GUIEventAdapter> event_old
protected
GlobalData& globalData
protected
double lengthAccuracy
protected
double lengthSmoothness
protected
float modelScale
protected
osg::ref_ptr<osg::Node> node
protected
osg::Matrixd pose
protected

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