Go to the documentation of this file.
32 #ifndef RVIZ_ANIMATED_VIEW_CONTROLLER_H
33 #define RVIZ_ANIMATED_VIEW_CONTROLLER_H
35 #include <boost/circular_buffer.hpp>
48 #include <geometry_msgs/Pose.h>
50 #include <std_msgs/Bool.h>
51 #include <std_msgs/Duration.h>
53 #include <view_controller_msgs/CameraMovement.h>
54 #include <view_controller_msgs/CameraPlacement.h>
55 #include <view_controller_msgs/CameraTrajectory.h>
57 #include <OGRE/OgreRenderWindow.h>
58 #include <OGRE/OgreVector3.h>
59 #include <OGRE/OgreQuaternion.h>
67 class QuaternionProperty;
68 class TfFrameProperty;
69 class EditableEnumProperty;
70 class RosTopicProperty;
90 const Ogre::Vector3&
focus,
91 const Ogre::Vector3&
up,
134 void move_eye(
float x,
float y,
float z );
149 virtual void lookAt(
const Ogre::Vector3& point );
159 virtual void reset();
203 virtual void update(
float dt,
float ros_dt);
248 uint8_t interpolation_speed);
254 void getViewImage(std::shared_ptr<Ogre::PixelBox>& pixel_box);
256 void convertImage(std::shared_ptr<Ogre::PixelBox> input_image,
257 sensor_msgs::ImagePtr output_image);
271 virtual void onAttachedFrameChanged(
const Ogre::Vector3& old_reference_position,
const Ogre::Quaternion& old_reference_orientation );
298 geometry_msgs::PointStamped& focus,
299 geometry_msgs::Vector3Stamped& up);
314 const Ogre::Vector3& focus,
315 const Ogre::Vector3& up,
317 uint8_t interpolation_speed = view_controller_msgs::CameraMovement::WAVE);
391 #endif // RVIZ_ANIMATED_VIEW_CONTROLLER_H
virtual void handleMouseEvent(rviz::ViewportMouseEvent &evt)
virtual void onUpPropertyChanged()
Called when up vector property is changed (does nothing for now...).
rviz::EditableEnumProperty * interaction_mode_property_
Select between Orbit or FPS control style.
ros::Subscriber placement_subscriber_
virtual void update(float dt, float ros_dt)
Called at 30Hz by ViewManager::update() while this view is active. Override with code that needs to r...
QCursor interaction_disabled_cursor_
A cursor for indicating mouse interaction is disabled.
ros::Duration transition_duration
void cancelTransition()
Cancels any currently active camera movement.
void pauseAnimationCallback(const std_msgs::Duration::ConstPtr &pause_duration_msg)
Sets the duration the rendering has to wait for during the next update cycle.
rviz::BoolProperty * fixed_up_property_
If True, "up" is fixed to ... up.
rviz::FloatProperty * window_width_property_
The width of the rviz visualization window in pixels.
BufferCamMovements cam_movements_buffer_
ros::Publisher current_camera_pose_publisher_
void beginNewTransition(const Ogre::Vector3 &eye, const Ogre::Vector3 &focus, const Ogre::Vector3 &up, ros::Duration transition_duration, uint8_t interpolation_speed=view_controller_msgs::CameraMovement::WAVE)
Begins a camera movement animation to the given goal point.
ros::Subscriber pause_animation_duration_subscriber_
rviz::VectorProperty * eye_point_property_
The position of the camera.
void updateAttachedSceneNode()
Update the position of the attached_scene_node_ from the TF frame specified in the Attached Frame pro...
float getDistanceFromCameraToFocalPoint()
Return the distance between camera and focal point.
bool render_frame_by_frame_
void move_eye(float x, float y, float z)
Applies a translation to only the eye point.
virtual ~AnimatedViewController()
void publishCameraPose()
Publishes the current camera pose.
rviz::TfFrameProperty * attached_frame_property_
void setPropertiesFromCamera(Ogre::Camera *source_camera)
double computeRelativeProgressInTime(const ros::Duration &transition_duration)
Computes the fraction of time we already used for the current movement.
virtual void onDistancePropertyChanged()
Called when distance property is changed; computes new eye position.
void cameraPlacementCallback(const view_controller_msgs::CameraPlacementConstPtr &cp_ptr)
OgreCameraMovement(const Ogre::Vector3 &eye, const Ogre::Vector3 &focus, const Ogre::Vector3 &up, const ros::Duration &transition_duration, const uint8_t interpolation_speed)
void updateWindowSizeProperties()
ros::Publisher finished_animation_publisher_
Ogre::SceneNode * attached_scene_node_
void disconnectPositionProperties()
Convenience function; disconnects the signals/slots for position properties.
Ogre::Quaternion getOrientation()
Return a Quaternion.
rviz::FloatProperty * distance_property_
The camera's distance from the focal point.
void orbitCameraTo(const Ogre::Vector3 &point)
Calls beginNewTransition() with the focus point fixed, moving the eye to the point given.
virtual void onActivate()
called by activate().
rviz::RosTopicProperty * camera_trajectory_topic_property_
rviz::VectorProperty * up_vector_property_
The up vector for the camera.
boost::circular_buffer< OgreCameraMovement > BufferCamMovements
void updateCamera()
Updates the Ogre camera properties from the view controller properties.
rviz::FloatProperty * default_transition_time_property_
A default time for any animation requests.
rviz::BoolProperty * mouse_enabled_property_
If True, most user changes to camera state are disabled.
rviz::VectorProperty * focus_point_property_
The point around which the camera "orbits".
virtual void onAttachedFrameChanged(const Ogre::Vector3 &old_reference_position, const Ogre::Quaternion &old_reference_orientation)
Override to implement the change in properties which nullifies the change in attached frame.
virtual void onEyePropertyChanged()
Called when eye property is changed; computes new distance.
rviz::Shape * focal_shape_
A small ellipsoid to show the focus point.
Ogre::Quaternion reference_orientation_
Used to store the orientation of the attached frame relative to <Fixed Frame>
ros::WallDuration pause_animation_duration_
void getViewImage(std::shared_ptr< Ogre::PixelBox > &pixel_box)
Get the current image rviz is showing as an Ogre::PixelBox.
void moveEyeWithFocusTo(const Ogre::Vector3 &point)
Calls beginNewTransition() to move the eye to the point given, keeping the direction fixed.
Ogre::Vector3 reference_position_
Used to store the position of the attached frame relative to <Fixed Frame>
An un-constrained "flying" camera, specified by an eye point, focus point, and up vector.
virtual void lookAt(const Ogre::Vector3 &point)
Calls beginNewTransition() to move the focus point to the point provided, assumed to be in the Rviz F...
virtual void reset()
Resets the camera parameters to a sane value.
ros::Subscriber trajectory_subscriber_
virtual void transitionFrom(ViewController *previous_view)
Called by ViewManager when this ViewController is being made current.
virtual void onFocusPropertyChanged()
Called focus property is changed; computes new distance.
int rendered_frames_counter_
void yaw_pitch_roll(float yaw, float pitch, float roll)
Applies a body-fixed-axes sequence of rotations; only accurate for small angles.
void transformCameraToAttachedFrame(geometry_msgs::PointStamped &eye, geometry_msgs::PointStamped &focus, geometry_msgs::Vector3Stamped &up)
Transforms the camera defined by eye, focus and up into the attached frame.
virtual void mimic(ViewController *source_view)
Configure the settings of this view controller to give, as much as possible, a similar view as that g...
bool isMovementAvailable()
Returns true if buffer contains at least one start and end pose needed for one movement.
void cameraTrajectoryCallback(const view_controller_msgs::CameraTrajectoryConstPtr &ct_ptr)
Initiate camera motion from incoming CameraTrajectory.
image_transport::Publisher camera_view_image_publisher_
Ogre::Vector3 attachedLocalToFixedFrame(const Ogre::Vector3 &v)
void pauseAnimationOnRequest()
Pauses the animation if pause_animation_duration_ is larger than zero.
ros::WallTime transition_start_time_
void move_focus_and_eye(float x, float y, float z)
Applies a translation to the focus and eye points.
void convertImage(std::shared_ptr< Ogre::PixelBox > input_image, sensor_msgs::ImagePtr output_image)
Ogre::Vector3 fixedFrameToAttachedLocal(const Ogre::Vector3 &v)
rviz::BoolProperty * publish_view_images_property_
If True, the camera view is published as images.
float computeRelativeProgressInSpace(double relative_progress_in_time, uint8_t interpolation_speed)
Convert the relative progress in time to the corresponding relative progress in space wrt....
void connectPositionProperties()
Convenience function; connects the signals/slots for position properties.
rviz::RosTopicProperty * camera_placement_topic_property_
void prepareNextMovement(const ros::Duration &previous_transition_duration)
Updates the transition_start_time_ and resets the rendered_frames_counter_ for next movement.
void initializeSubscribers()
bool dragging_
A flag indicating the dragging state of the mouse.
virtual void updateAttachedFrame()
Called when Target Frame property changes while view is active. Purpose is to change values in the vi...
uint8_t interpolation_speed
void initializePublishers()
void publishViewImage()
Publish the rendered image that is visible to the user in rviz.
virtual void onInitialize()
Do subclass-specific initialization. Called by ViewController::initialize after context_ and camera_ ...
rviz::FloatProperty * window_height_property_
The height of the rviz visualization window in pixels.