Class OrbitViewController

Inheritance Relationships

Base Type

  • public rviz_common::FramePositionTrackingViewController

Derived Type

Class Documentation

class OrbitViewController : public rviz_common::FramePositionTrackingViewController

An orbital camera, controlled by yaw, pitch, distance, and focal point.

This camera is based on the equation of a sphere in spherical coordinates:

x = distance * cos(yaw) * sin(pitch) y = distance * cos(pitch) z = distance * sin(yaw) * sin(pitch)

The coordinates are then offset by the focal point

Subclassed by rviz_default_plugins::view_controllers::XYOrbitViewController

Public Functions

OrbitViewController()
~OrbitViewController() override
void onInitialize() override

Do subclass-specific initialization.

Called by ViewController::initialize after context_, target_scene_node_, and camera_ are set.

void zoom(float amount)

Move in/out from the focal point, i.e. adjust distance by amount.

Positive amount moves towards the focal point, negative moves away.

Parameters:

amount – The distance to move.

void yaw(float angle)

Set the yaw angle.

void pitch(float angle)

Set the pitch angle.

void move(float x, float y, float z)

Move the focal point.

void handleMouseEvent(rviz_common::ViewportMouseEvent &evt) override

Handle incoming mouse events.

void lookAt(const Ogre::Vector3 &point) override

Look at a given location by changing the distance and angles.

void reset() override

Reset the distance and angles to their default values.

void mimic(ViewController *source_view) override

Configure this view controller to give a similar view to the given source_view.

Parameters:

source_view – must return a valid Ogre::Camera * from getCamera().

rviz_common::FocalPointStatus getFocalPointStatus() override
void update(float dt, float ros_dt) override

Protected Functions

bool setMouseMovementFromEvent(const rviz_common::ViewportMouseEvent &event, int32_t &diff_x, int32_t &diff_y)
void rotateCamera(int32_t diff_x, int32_t diff_y)
virtual void moveFocalPoint(float distance, int32_t diff_x, int32_t diff_y, int32_t last_x, int32_t last_y)
virtual void handleWheelEvent(rviz_common::ViewportMouseEvent &event, float distance)
virtual void handleRightClick(rviz_common::ViewportMouseEvent &event, float distance, int32_t diff_y)
virtual void setShiftOrbitStatus()
void setDefaultOrbitStatus()
void onTargetFrameChanged(const Ogre::Vector3 &old_reference_position, const Ogre::Quaternion &old_reference_orientation) override
void calculatePitchYawFromPosition(const Ogre::Vector3 &position)

Calculate the pitch and yaw values given a new position and the current focal point.

Parameters:

position – the position from which to calculate the pitch/yaw.

void updateFocalShapeSize()

Calculate the focal shape size and update it’s geometry.

virtual void updateCamera()
Ogre::Vector3 mimicTopDownViewController(rviz_common::ViewController *view_controller)

Protected Attributes

rviz_common::properties::FloatProperty *yaw_property_

The camera’s yaw (rotation around the y-axis), in radians.

rviz_common::properties::FloatProperty *pitch_property_

The camera’s pitch (rotation around the x-axis), in radians.

rviz_common::properties::FloatProperty *distance_property_

The camera’s distance from the focal point.

rviz_common::properties::VectorProperty *focal_point_property_

The point around which the camera “orbits”.

rviz_common::properties::BoolProperty *focal_shape_fixed_size_property_

Whether the focal shape size is fixed or not.

rviz_common::properties::FloatProperty *focal_shape_size_property_

The focal shape size.

std::unique_ptr<rviz_rendering::Shape> focal_shape_