Gazebo Gazebo

API Reference

6.16.0

A QQUickItem that manages the render window. More...

#include <Scene3D.hh>

Public Slots

void OnContextMenuRequested (QString _entity)
 Qt callback when context menu request is received. More...
 
void Ready ()
 Slot called when thread is ready to be started. More...
 
void SetFollowTarget (const std::string &_target, bool _waitForTarget=false)
 Move the user camera to follow the specified target. More...
 

Signals

void openContextMenu (QString _entity)
 Signal fired to open context menu Note that the function name needs to start with lowercase in order for the connection to work on the QML side. More...
 

Public Member Functions

 RenderWindowItem (QQuickItem *_parent=nullptr)
 Constructor. More...
 
 ~RenderWindowItem () override
 Destructor. More...
 
math::Pose3d CameraPose () const
 Get the user camera pose. More...
 
void DeselectAllEntities (bool _sendEvent)
 Deselect all the currently selected entities within the RenderUtil class. More...
 
void HandleKeyPress (QKeyEvent *_e)
 Handle key press event for snapping. More...
 
void HandleKeyRelease (QKeyEvent *_e)
 Handle key release event for snapping. More...
 
void OnHovered (const gz::math::Vector2i &_hoverPos)
 Called when the mouse hovers to a new position. More...
 
bool RendererInitialized () const
 Get whether the renderer is initialized. The renderer is initialized when the context is created and the render thread is started. More...
 
class RenderUtilRenderUtil () const
 Set the renderer. More...
 
math::Vector3d ScreenToScene (const math::Vector2i &_screenPos)
 Retrieve the first point on a surface in the 3D scene hit by a ray cast from the given 2D screen coordinates. More...
 
void SetCameraPose (const math::Pose3d &_pose)
 Set the initial user camera pose. More...
 
void SetDropdownMenuEnabled (bool _enableDropdownMenu)
 Set if the dropdown menu is enabled or disabled. More...
 
void SetErrorCb (std::function< void(const QString &)> _cb)
 Set a callback to be called in case there are errors. More...
 
void SetFollowOffset (const math::Vector3d &_offset)
 Set the camera follow offset position. More...
 
void SetFollowPGain (double _gain)
 Set the p gain for the camera follow movement. More...
 
void SetFollowWorldFrame (bool _worldFrame)
 True to set the camera to follow the target in world frame, false to follow in target's local frame. More...
 
void SetInitCameraPose (const math::Pose3d &_pose)
 Set the initial user camera pose. More...
 
void SetModel (const std::string &_model)
 Set the model to hover. More...
 
void SetModelPath (const std::string &_filePath)
 Set the path of the model to hover. More...
 
void SetMoveTo (const std::string &_target)
 Move the user camera to move to the specified target. More...
 
void SetMoveToPose (const math::Pose3d &_pose)
 Set the pose of the camera. More...
 
void SetRecordVideo (bool _record, const std::string &_format, const std::string &_savePath)
 Set whether to record video. More...
 
void SetRecordVideoBitrate (unsigned int _bitrate)
 Set video recorder bitrate in bps. More...
 
void SetRecordVideoLockstep (bool _lockstep)
 Set whether to record video in lockstep mode. More...
 
void SetRecordVideoUseSimTime (bool _useSimTime)
 Set whether to record video using sim time as timestamp. More...
 
void SetRPYSnap (const math::Vector3d &_rpy)
 Set the RPY snap values from the user input. More...
 
void SetScaleSnap (const math::Vector3d &_scale)
 Set the scale snap values from the user input. More...
 
void SetTransformMode (const std::string &_mode)
 Set the transform mode. More...
 
void SetViewAngle (const math::Vector3d &_direction)
 Set the viewing angle of the camera. More...
 
void SetViewCollisionsTarget (const std::string &_target)
 View collisions of the specified target. More...
 
void SetViewCOMTarget (const std::string &_target)
 View center of mass of the specified target. More...
 
void SetViewController (const std::string &_viewController)
 Set camera view controller. More...
 
void SetViewInertiaTarget (const std::string &_target)
 View inertia of the specified target. More...
 
void SetViewJointsTarget (const std::string &_target)
 View joints of the specified target. More...
 
void SetViewTransparentTarget (const std::string &_target)
 View the specified target as transparent. More...
 
void SetViewWireframesTarget (const std::string &_target)
 View wireframes of the specified target. More...
 
void SetVisibilityMask (uint32_t _mask)
 Set the user camera visibility mask. More...
 
void SetWorldName (const std::string &_name)
 Set the world name. More...
 
void SetXYZSnap (const math::Vector3d &_xyz)
 Set the XYZ snap values from the user input. More...
 
void UpdateSelectedEntity (Entity _entity, bool _sendEvent)
 An update function to apply the rules of selection to the passed in node. The rules are as follows: More...
 

Protected Member Functions

void mouseMoveEvent (QMouseEvent *_e) override
 
void mousePressEvent (QMouseEvent *_e) override
 
void mouseReleaseEvent (QMouseEvent *_e) override
 
void wheelEvent (QWheelEvent *_e) override
 

Detailed Description

A QQUickItem that manages the render window.

Constructor & Destructor Documentation

◆ RenderWindowItem()

RenderWindowItem ( QQuickItem *  _parent = nullptr)
explicit

Constructor.

Parameters
[in]_parentParent item

◆ ~RenderWindowItem()

~RenderWindowItem ( )
override

Destructor.

Member Function Documentation

◆ CameraPose()

math::Pose3d CameraPose ( ) const

Get the user camera pose.

Returns
Pose of the user camera.

◆ DeselectAllEntities()

void DeselectAllEntities ( bool  _sendEvent)

Deselect all the currently selected entities within the RenderUtil class.

Parameters
[in]_sendEventTrue to notify other widgets. This should be true when the deselection is initiated from this plugin.

◆ HandleKeyPress()

void HandleKeyPress ( QKeyEvent *  _e)

Handle key press event for snapping.

Parameters
[in]_eThe key event to process.

◆ HandleKeyRelease()

void HandleKeyRelease ( QKeyEvent *  _e)

Handle key release event for snapping.

Parameters
[in]_eThe key event to process.

◆ mouseMoveEvent()

void mouseMoveEvent ( QMouseEvent *  _e)
overrideprotected

◆ mousePressEvent()

void mousePressEvent ( QMouseEvent *  _e)
overrideprotected

◆ mouseReleaseEvent()

void mouseReleaseEvent ( QMouseEvent *  _e)
overrideprotected

◆ OnContextMenuRequested

void OnContextMenuRequested ( QString  _entity)
slot

Qt callback when context menu request is received.

Parameters
[in]_entityScoped name of entity.

◆ OnHovered()

void OnHovered ( const gz::math::Vector2i _hoverPos)

Called when the mouse hovers to a new position.

Parameters
[in]_hoverPos2D coordinates of the hovered mouse position on the render window.

◆ openContextMenu

void openContextMenu ( QString  _entity)
signal

Signal fired to open context menu Note that the function name needs to start with lowercase in order for the connection to work on the QML side.

Parameters
[in]_entityScoped name of entity.

◆ Ready

void Ready ( )
slot

Slot called when thread is ready to be started.

◆ RendererInitialized()

bool RendererInitialized ( ) const

Get whether the renderer is initialized. The renderer is initialized when the context is created and the render thread is started.

Returns
True if the renderer is initialized.

◆ RenderUtil()

class RenderUtil* RenderUtil ( ) const

Set the renderer.

◆ ScreenToScene()

math::Vector3d ScreenToScene ( const math::Vector2i _screenPos)

Retrieve the first point on a surface in the 3D scene hit by a ray cast from the given 2D screen coordinates.

Parameters
[in]_screenPos2D coordinates on the screen, in pixels.
Returns
3D coordinates of a point in the 3D scene.

◆ SetCameraPose()

void SetCameraPose ( const math::Pose3d _pose)

Set the initial user camera pose.

Parameters
[in]_posePose to set the camera to

◆ SetDropdownMenuEnabled()

void SetDropdownMenuEnabled ( bool  _enableDropdownMenu)

Set if the dropdown menu is enabled or disabled.

Parameters
[in]_enableDropdownMenuThe boolean to enable or disable the menu

◆ SetErrorCb()

void SetErrorCb ( std::function< void(const QString &)>  _cb)

Set a callback to be called in case there are errors.

Parameters
[in]_cbError callback

◆ SetFollowOffset()

void SetFollowOffset ( const math::Vector3d _offset)

Set the camera follow offset position.

Parameters
[in]_offsetCamera follow offset position.

◆ SetFollowPGain()

void SetFollowPGain ( double  _gain)

Set the p gain for the camera follow movement.

Parameters
[in]_gainCamera follow p gain.

◆ SetFollowTarget

void SetFollowTarget ( const std::string _target,
bool  _waitForTarget = false 
)
slot

Move the user camera to follow the specified target.

Parameters
[in]_targetTarget to follow
[in]_waitForTargetTrue to continuously look for the target to follow. A typical use case is follow a target that is not present on startup but spawned later into simulation

◆ SetFollowWorldFrame()

void SetFollowWorldFrame ( bool  _worldFrame)

True to set the camera to follow the target in world frame, false to follow in target's local frame.

Parameters
[in]_worldFrameTrue to use the world frame.

◆ SetInitCameraPose()

void SetInitCameraPose ( const math::Pose3d _pose)

Set the initial user camera pose.

Parameters
[in]_posePose to set the camera to

◆ SetModel()

void SetModel ( const std::string _model)

Set the model to hover.

Parameters
[in]_modelSdf string of the model to load in for the user.

◆ SetModelPath()

void SetModelPath ( const std::string _filePath)

Set the path of the model to hover.

Parameters
[in]_filePathFile path of the model to load in for the user.

◆ SetMoveTo()

void SetMoveTo ( const std::string _target)

Move the user camera to move to the specified target.

Parameters
[in]_targetTarget to move the camera to

◆ SetMoveToPose()

void SetMoveToPose ( const math::Pose3d _pose)

Set the pose of the camera.

Parameters
[in]_poseThe new camera pose in the world frame.

◆ SetRecordVideo()

void SetRecordVideo ( bool  _record,
const std::string _format,
const std::string _savePath 
)

Set whether to record video.

Parameters
[in]_recordTrue to start video recording, false to stop.
[in]_formatVideo encoding format: "mp4", "ogv"
[in]_savePathPath to save the recorded video.

◆ SetRecordVideoBitrate()

void SetRecordVideoBitrate ( unsigned int  _bitrate)

Set video recorder bitrate in bps.

Parameters
[in]_bitrateBit rate to set to

◆ SetRecordVideoLockstep()

void SetRecordVideoLockstep ( bool  _lockstep)

Set whether to record video in lockstep mode.

Parameters
[in]_lockstepTrue to record video in lockstep mode

◆ SetRecordVideoUseSimTime()

void SetRecordVideoUseSimTime ( bool  _useSimTime)

Set whether to record video using sim time as timestamp.

Parameters
[in]_useSimTimeTrue record video using sim time

◆ SetRPYSnap()

void SetRPYSnap ( const math::Vector3d _rpy)

Set the RPY snap values from the user input.

Parameters
[in]_rpyThe RPY snap values

◆ SetScaleSnap()

void SetScaleSnap ( const math::Vector3d _scale)

Set the scale snap values from the user input.

Parameters
[in]_scaleThe scale snap values

◆ SetTransformMode()

void SetTransformMode ( const std::string _mode)

Set the transform mode.

Parameters
[in]_modeNew transform mode to set to

◆ SetViewAngle()

void SetViewAngle ( const math::Vector3d _direction)

Set the viewing angle of the camera.

Parameters
[in]_directionThe pose to assume relative to the entit(y/ies). (0, 0, 0) indicates to return the camera back to the home pose originally loaded in from the sdf

◆ SetViewCollisionsTarget()

void SetViewCollisionsTarget ( const std::string _target)

View collisions of the specified target.

Parameters
[in]_targetTarget to view collisions

◆ SetViewCOMTarget()

void SetViewCOMTarget ( const std::string _target)

View center of mass of the specified target.

Parameters
[in]_targetTarget to view center of mass

◆ SetViewController()

void SetViewController ( const std::string _viewController)

Set camera view controller.

Parameters
[in]_viewController.Values are "orbit", and "ortho"

◆ SetViewInertiaTarget()

void SetViewInertiaTarget ( const std::string _target)

View inertia of the specified target.

Parameters
[in]_targetTarget to view inertia

◆ SetViewJointsTarget()

void SetViewJointsTarget ( const std::string _target)

View joints of the specified target.

Parameters
[in]_targetTarget to view joints

◆ SetViewTransparentTarget()

void SetViewTransparentTarget ( const std::string _target)

View the specified target as transparent.

Parameters
[in]_targetTarget to view as transparent

◆ SetViewWireframesTarget()

void SetViewWireframesTarget ( const std::string _target)

View wireframes of the specified target.

Parameters
[in]_targetTarget to view wireframes

◆ SetVisibilityMask()

void SetVisibilityMask ( uint32_t  _mask)

Set the user camera visibility mask.

Parameters
[in]_maskVisibility mask to set to

◆ SetWorldName()

void SetWorldName ( const std::string _name)

Set the world name.

Parameters
[in]_nameName of the world to set to.

◆ SetXYZSnap()

void SetXYZSnap ( const math::Vector3d _xyz)

Set the XYZ snap values from the user input.

Parameters
[in]_xyzThe XYZ snap values

◆ UpdateSelectedEntity()

void UpdateSelectedEntity ( Entity  _entity,
bool  _sendEvent 
)

An update function to apply the rules of selection to the passed in node. The rules are as follows:

  • If control is held, append the node to the selected entity list.
  • If control is not held, deselect all other entities.
  • If the user is currently in a transform mode, attach the control to the latest selected node and deselect all others. Note that this function emits events to update other widgets.
    Parameters
    [in]_entityThe entity to select.
    [in]_sendEventTrue to notify other widgets. This should be true when the selection is initiated from this plugin.

◆ wheelEvent()

void wheelEvent ( QWheelEvent *  _e)
overrideprotected

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