Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
Camera Class Reference

Basic camera sensor. More...

#include <Camera.hh>

Inheritance diagram for Camera:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Camera (const std::string &namePrefix, Scene *scene, bool _autoRender=true)
 Constructor.
virtual ~Camera ()
 Destructor.
void Load (sdf::ElementPtr &_sdf)
 Load the camera with a set of parmeters.
void Load ()
 Load the camera with default parmeters.
void Init ()
 Initialize the camera.
void SetRenderRate (double _hz)
 Set the render Hz rate.
void Render ()
 Render the camera.
virtual void PostRender ()
 Post render.
virtual void Update ()
 Update the sensor information.
void Fini ()
 Finalize the camera.
void SetWindowId (unsigned int windowId)
 Set the ID of the window this camera is rendering into.
unsigned int GetWindowId () const
 Get the ID of the window this camera is rendering into.
void SetScene (Scene *scene)
 Set the scene this camera is viewing.
math::Pose GetWorldPose ()
 Get the global pose of the camera.
math::Vector3 GetWorldPosition () const
 Get the camera position in the world.
math::Quaternion GetWorldRotation () const
 Get the camera's orientation in the world.
void SetWorldPose (const math::Pose &_pose)
 Set the global pose of the camera.
void SetWorldPosition (const math::Vector3 &_pos)
 Set the world position.
void SetWorldRotation (const math::Quaternion &_quant)
 Set the world orientation.
void Translate (const math::Vector3 &direction)
 Translate the camera.
void RotateYaw (float angle)
 Rotate the camera around the yaw axis.
void RotatePitch (float angle)
 Rotate the camera around the pitch axis.
void SetClipDist (float near, float far)
 Set the clip distances.
void SetClipDist ()
void SetHFOV (float radians)
 Set the camera FOV (horizontal)
math::Angle GetHFOV () const
 Get the camera FOV (horizontal)
math::Angle GetVFOV () const
 Get the camera FOV (vertical)
void SetImageSize (unsigned int _w, unsigned int _h)
 Set the image size.
void SetImageWidth (unsigned int _w)
 Set the image height.
void SetImageHeight (unsigned int _h)
 Set the image height.
unsigned int GetImageWidth () const
 Get the width of the image.
unsigned int GetTextureWidth () const
 Get the width of the texture.
unsigned int GetImageHeight () const
 Get the height of the image.
unsigned int GetImageDepth () const
 Get the height of the image.
std::string GetImageFormat () const
 Get the height of the image.
unsigned int GetTextureHeight () const
 Get the height of the texture.
size_t GetImageByteSize () const
 Get the image size in bytes.
double GetZValue (int x, int y)
 Get the Z-buffer value at the given image coordinate.
double GetNearClip ()
 Get the near clip distance.
double GetFarClip ()
 Get the far clip distance.
void EnableSaveFrame (bool enable)
 Enable or disable saving.
void SetSaveFramePathname (const std::string &pathname)
 Set the save frame pathname.
Ogre::Camera * GetOgreCamera () const
 Get a pointer to the ogre camera.
Ogre::Viewport * GetViewport () const
unsigned int GetViewportWidth () const
 Get the viewport width in pixels.
unsigned int GetViewportHeight () const
 Get the viewport height in pixels.
math::Vector3 GetUp ()
 Get the viewport up vector.
math::Vector3 GetRight ()
 Get the viewport right vector.
virtual float GetAvgFPS ()
 Get the average FPS.
virtual unsigned int GetTriangleCount ()
 Get the triangle count.
void SetAspectRatio (float ratio)
 Set the aspect ratio.
float GetAspectRatio () const
 Get the apect ratio.
void SetSceneNode (Ogre::SceneNode *node)
 Set the camera's scene node.
Ogre::SceneNode * GetSceneNode () const
 Get the camera's scene node.
virtual const unsigned char * GetImageData (unsigned int i=0)
 Get a pointer to the image data.
std::string GetName () const
 Get the camera's name.
void SetName (const std::string &name)
 Set the camera's name.
void ToggleShowWireframe ()
 Toggle whether to view the world in wireframe.
void ShowWireframe (bool s)
 Set whether to view the world in wireframe.
void GetCameraToViewportRay (int screenx, int screeny, math::Vector3 &origin, math::Vector3 &dir)
 Get a world space ray as cast from the camera through the viewport.
void SetCaptureData (bool value)
 Set whether to capture data.
void CreateRenderTexture (const std::string &textureName)
 Set the render target.
SceneGetScene () const
 Get the scene this camera is in.
bool GetWorldPointOnPlane (int _x, int _y, const math::Vector3 &_planeNorm, double _d, math::Vector3 &_result)
 Get point on a plane.
virtual void SetRenderTarget (Ogre::RenderTarget *target)
void AttachToVisual (const std::string &_visualName, bool _inheritOrientation, double _minDist=0, double _maxDist=0)
 Attach the camera to a scene node.
void TrackVisual (const std::string &_visualName)
 Set the camera to track a scene node.
Ogre::Texture * GetRenderTexture () const
 Get the render texture.
math::Vector3 GetDirection () const
 Get the camera's direction vector.
template<typename T >
event::ConnectionPtr ConnectNewImageFrame (T subscriber)
 Connect a to the add entity signal.
void DisconnectNewImageFrame (event::ConnectionPtr &c)
common::Time GetLastRenderWallTime ()
 Get the last time the camera was rendered.
bool IsVisible (VisualPtr _visual)
 Return true if the visual is within the camera's view frustum.
bool IsVisible (const std::string &_visualName)
 Return true if the visual is within the camera's view frustum.
bool GetInitialized () const
 Returns true if initialized.

Static Public Member Functions

static size_t GetImageByteSize (unsigned int _width, unsigned int _height, const std::string &_format)
static void SaveFrame (const unsigned char *_image, unsigned int _width, unsigned int _height, int _depth, const std::string &_format, const std::string &_filename)

Public Attributes

bool initialized

Protected Member Functions

virtual void RenderImpl ()
bool TrackVisualImpl (const std::string &_visualName)
virtual bool TrackVisualImpl (VisualPtr _visual)
 Set the camera to track a scene node.
virtual bool AttachToVisualImpl (const std::string &_name, bool _inheritOrientation, double _minDist=0, double _maxDist=0)
 Attach the camera to a visual.
virtual bool AttachToVisualImpl (VisualPtr _visual, bool _inheritOrientation, double _minDist=0, double _maxDist=0)
 Attach the camera to a visual.
virtual void SaveFrame ()

Protected Attributes

sdf::ElementPtr sdf
unsigned int windowId
unsigned int textureWidth
unsigned int textureHeight
Ogre::Camera * camera
Ogre::Viewport * viewport
Ogre::SceneNode * origParentNode
Ogre::SceneNode * sceneNode
Ogre::SceneNode * pitchNode
unsigned char * saveFrameBuffer
unsigned char * bayerFrameBuffer
unsigned int saveCount
int imageFormat
int imageWidth
int imageHeight
Ogre::RenderTarget * renderTarget
Ogre::Texture * renderTexture
bool captureData
bool newData
common::Time lastRenderWallTime
Scenescene
event::EventT< void(const
unsigned char *, unsigned int,
unsigned int, unsigned int,
const std::string &) 
newImageFrame )
std::vector< event::ConnectionPtr > connections
std::list< msgs::Request > requests

Detailed Description

Basic camera sensor.

This is the base class for all cameras.


Member Function Documentation

bool GetWorldPointOnPlane ( int  _x,
int  _y,
const math::Vector3 _planeNorm,
double  _d,
math::Vector3 _result 
)

Get point on a plane.

Returns:
True if a valid point was found
double GetZValue ( int  x,
int  y 
)

Get the Z-buffer value at the given image coordinate.

Parameters:
x,yImage coordinate; (0, 0) specifies the top-left corner.
Returns:
Image z value; note that this is abitrarily scaled and is not the same as the depth value.
void Load ( sdf::ElementPtr &  _sdf)

Load the camera with a set of parmeters.

Parameters:
_sdfThe SDF camera info

Reimplemented in DepthCamera.


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