mars
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
mars::HighResRangeFinder Class Reference

#include <HighResRangeFinder.hpp>

Inheritance diagram for mars::HighResRangeFinder:

Classes

struct  Camera
 

Public Member Functions

 HighResRangeFinder (std::string const &name="mars::HighResRangeFinder")
 
 HighResRangeFinder (std::string const &name, RTT::ExecutionEngine *engine)
 
 ~HighResRangeFinder ()
 
bool configureHook ()
 The following lines are template definitions for the various state machine. More...
 
bool startHook ()
 
void updateHook ()
 
void errorHook ()
 
void stopHook ()
 
void cleanupHook ()
 
virtual void getData ()
 

Protected Member Functions

virtual bool addCamera (::std::string const &name, double orientation)
 
void calcCamParameters (Camera *camera)
 

Protected Attributes

std::vector< Camera * > cameras
 

Friends

class HighResRangeFinderBase
 

Detailed Description

Allows to simulate 360deg laserscanners using distance images to increase performance. At the moment each camera sensor in MARS provides an opening angle of 90deg, so four cameras are required to cover the complete 360deg. Initially a single camera is used to create the pointcloud and with 'addCamera()' further cameras can be added. The following example shows how to start this sensor using two cameras in ruby:

velodyne = TaskContext.get 'mars_velodyne'
velodyne.name = 'velodyne'
velodyne.configure
velodyne.start
velodyne.addCamera('velodyne90',90);

See the documentation of addCamera() for a scene file example.
The z-axis of the image scene coordinate system points towards the image plane, the x-axis points right and the y-axis down.

Constructor & Destructor Documentation

HighResRangeFinder::HighResRangeFinder ( std::string const &  name = "mars::HighResRangeFinder")

TaskContext constructor for HighResRangeFinder

Parameters
nameName of the task. This name needs to be unique to make it identifiable via nameservices.
initial_stateThe initial TaskState of the TaskContext. Default is Stopped state.
HighResRangeFinder::HighResRangeFinder ( std::string const &  name,
RTT::ExecutionEngine *  engine 
)

TaskContext constructor for HighResRangeFinder

Parameters
nameName of the task. This name needs to be unique to make it identifiable for nameservices.
engineThe RTT Execution engine to be used for this task, which serialises the execution of all commands, programs, state machines and incoming events for a task.
HighResRangeFinder::~HighResRangeFinder ( )

Default deconstructor of HighResRangeFinder

Member Function Documentation

bool HighResRangeFinder::addCamera ( ::std::string const &  name,
double  orientation 
)
protectedvirtual

Loads another camera from the scene file which will be used for pointcloud creation. Within the scene file the yaw angle has to be used to create a full 360deg sensor.
E.g. the following scene file shows the front and the left camera.

<sensor name="velodyne" type="CameraSensor">
<index>1</index>
<rate>10</rate>
<attached_node>1</attached_node>
<depth_image>1.0</depth_image>
<show_cam hud_idx="1">1.0</show_cam>
<position_offset x="-0.03838" y="0.00122" z="0.527"/>
<orientation_offset yaw="0" pitch="0" roll="0"/>
</sensor>
<sensor name="velodyne90" type="CameraSensor">
<index>2</index>
<rate>10</rate>
<attached_node>1</attached_node>
<depth_image>1.0</depth_image>
<show_cam hud_idx="2">1.0</show_cam>
<position_offset x="-0.03838" y="0.00122" z="0.527"/>
<orientation_offset yaw="90" pitch="0" roll="0"/>
</sensor>
Parameters
nameName of the camera within the scene file. In the example above it would be 'velodyne90'.
orientationOrientation of the camera around the y-axis within the camera frame.
void HighResRangeFinder::calcCamParameters ( Camera camera)
protected

Calculates which pixel will be converted into scene points in regard to the opening angle and the scan resolution.

void HighResRangeFinder::cleanupHook ( )

This hook is called by Orocos when the state machine transitions from Stopped to PreOperational, requiring the call to configureHook() before calling start() again.

bool HighResRangeFinder::configureHook ( )

The following lines are template definitions for the various state machine.

This hook is called by Orocos when the state machine transitions from PreOperational to Stopped. If it returns false, then the component will stay in PreOperational. Otherwise, it goes into Stopped.

It is meaningful only if the #needs_configuration has been specified in the task context definition with (for example):

task_context "TaskName" do
  needs_configuration
  ...
end
void HighResRangeFinder::errorHook ( )

This hook is called by Orocos when the component is in the RunTimeError state, at each activity step. See the discussion in updateHook() about triggering options.

Call recover() to go back in the Runtime state.

void HighResRangeFinder::getData ( )
virtual

Requests the distance image by calling DepthCamera::getData() and generates the pointcloud using the image data.

bool HighResRangeFinder::startHook ( )

This hook is called by Orocos when the state machine transitions from Stopped to Running. If it returns false, then the component will stay in Stopped. Otherwise, it goes into Running and updateHook() will be called.

void HighResRangeFinder::stopHook ( )

This hook is called by Orocos when the state machine transitions from Running to Stopped after stop() has been called.

void HighResRangeFinder::updateHook ( )

This hook is called by Orocos when the component is in the Running state, at each activity step. Here, the activity gives the "ticks" when the hook should be called.

The error(), exception() and fatal() calls, when called in this hook, allow to get into the associated RunTimeError, Exception and FatalError states.

In the first case, updateHook() is still called, and recover() allows you to go back into the Running state. In the second case, the errorHook() will be called instead of updateHook(). In Exception, the component is stopped and recover() needs to be called before starting it again. Finally, FatalError cannot be recovered.

Friends And Related Function Documentation

friend class HighResRangeFinderBase
friend

Member Data Documentation

std::vector<Camera*> mars::HighResRangeFinder::cameras
protected

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