Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
gazebo::gui::JointMaker Class Reference

Handles the creation of joints in the model editor. More...

#include <JointMaker.hh>

Inheritance diagram for gazebo::gui::JointMaker:
Inheritance graph
[legend]

Public Types

enum  JointType {
  JOINT_NONE, JOINT_FIXED, JOINT_SLIDER, JOINT_HINGE,
  JOINT_HINGE2, JOINT_SCREW, JOINT_UNIVERSAL, JOINT_BALL,
  JOINT_GEARBOX
}
 

Public Slots

void OnType (const int _typeInt)
 A new type for the joint being created has been chosen. More...
 
void SetAxis (const std::string &_axis, const ignition::math::Vector3d &_value)
 A new axis for the joint being created has been chosen. More...
 
void ShowJoints (const bool _show)
 Qt Callback to show / hide joint visuals. More...
 

Signals

void EmitLinkInserted (const std::string &_linkId)
 Qt signal to notify that a link has been inserted. More...
 
void EmitLinkRemoved (const std::string &_linkId)
 Qt signal to notify that a link has been removed. More...
 
void JointAdded ()
 Qt signal when the joint creation process has ended. More...
 

Public Member Functions

 JointMaker ()
 Constructor. More...
 
virtual ~JointMaker ()
 Destructor. More...
 
void AddJoint (const std::string &_type)
 Add a joint. More...
 
void AddJoint (const JointType _type)
 Add a joint. More...
 
void AddScopedLinkName (const std::string &_name)
 Add a scoped link name. More...
 
void AlignLinks (const bool _childToParent, const std::string &_axis, const std::string &_mode, const bool _reverse)
 Align the parent and child links of the joint being created. More...
 
std::string CreateHotSpot (JointData *_joint)
 Helper method to create hotspot visual for mouse interaction. More...
 
JointDataCreateJoint (const rendering::VisualPtr &_parent, const rendering::VisualPtr &_child)
 Create a joint with parent and child. More...
 
void CreateJointFromSDF (sdf::ElementPtr _jointElem, const std::string &_modelName="")
 Create a joint from SDF. More...
 
void DisableEventHandlers ()
 Disable the mouse and key event handlers for the joint maker. More...
 
void EnableEventHandlers ()
 Enable the mouse and key event handlers for the joint maker. More...
 
void FinalizeCreation ()
 Finalize joint creation. More...
 
void GenerateSDF ()
 Generate SDF for all joints. More...
 
unsigned int JointCount ()
 Get the number of joints added. More...
 
std::vector< JointData * > JointDataByLink (const std::string &_linkName) const
 Get a vector containing data for all joints connected to the given link. More...
 
std::map< std::string,
std::string > 
LinkList () const
 Get the list of links. More...
 
void RemoveJoint (const std::string &_jointName)
 Remove joint by name. More...
 
void RemoveJointsByLink (const std::string &_linkName)
 Remove all joints connected to link. More...
 
void Reset ()
 Reset the joint maker;. More...
 
sdf::ElementPtr SDF () const
 Get model SDF element containing all joints. More...
 
void SetChildLink (const std::string &_name)
 A new child link for the joint being created has been chosen. More...
 
void SetJointPose (const ignition::math::Pose3d &_pose)
 A new joint pose for the joint being created has been chosen. More...
 
void SetLinksRelativePose (const ignition::math::Pose3d &_pose, const bool _reset)
 A new relative pose for the child link of the joint being created hass been chosen. More...
 
void SetParentLink (const std::string &_name)
 A new parent link for the joint being created has been chosen. More...
 
void SetSelected (const std::string &_name, const bool selected)
 Set the select state of a joint. More...
 
void SetSelected (const rendering::VisualPtr &_jointVis, const bool selected)
 Set the select state of a joint visual. More...
 
JointMaker::JointType State () const
 Get state. More...
 
void Stop ()
 Stop the process of adding joint to the model. More...
 
void Update ()
 Update callback on PreRender. More...
 

Static Public Member Functions

static JointType ConvertJointType (const std::string &_type)
 Convert a joint type string to enum. More...
 
static unsigned int JointAxisCount (const JointMaker::JointType _type)
 Get the axis count for joint type. More...
 
static std::string JointMaterial (const std::string &_type)
 Get the material for the joint type. More...
 
static std::string TypeAsString (const JointMaker::JointType _type)
 Get the joint type in string. More...
 

Static Public Attributes

static std::map
< JointMaker::JointType,
std::string > 
jointMaterials
 A map of joint type to its corresponding material. More...
 
static std::map
< JointMaker::JointType,
std::string > 
jointTypes
 A map of joint type to its string value. More...
 
static std::vector
< ignition::math::Vector3d > 
unitVectors
 Constant vector containing [UnitX, UnitY, UnitZ]. More...
 

Detailed Description

Handles the creation of joints in the model editor.

Member Enumeration Documentation

Enumerator
JOINT_NONE 

none

JOINT_FIXED 

Fixed joint.

JOINT_SLIDER 

Slider joint.

JOINT_HINGE 

Hinge joint.

JOINT_HINGE2 

Hinge2 joint.

JOINT_SCREW 

Screw joint.

JOINT_UNIVERSAL 

Universal joint.

JOINT_BALL 

Ball joint.

JOINT_GEARBOX 

Gearbox joint.

Constructor & Destructor Documentation

gazebo::gui::JointMaker::JointMaker ( )

Constructor.

virtual gazebo::gui::JointMaker::~JointMaker ( )
virtual

Destructor.

Member Function Documentation

void gazebo::gui::JointMaker::AddJoint ( const std::string &  _type)

Add a joint.

Parameters
[in]_typeType of joint to be added in string.
void gazebo::gui::JointMaker::AddJoint ( const JointType  _type)

Add a joint.

Parameters
[in]_typeType of joint to be added
void gazebo::gui::JointMaker::AddScopedLinkName ( const std::string &  _name)

Add a scoped link name.

Nested model's link names are scoped but the parent and child field in the joint SDF element may not be. So keep track of scoped link names in order to generate the correct SDF before spawning the model.

Parameters
[in]_nameScoped link name.
void gazebo::gui::JointMaker::AlignLinks ( const bool  _childToParent,
const std::string &  _axis,
const std::string &  _mode,
const bool  _reverse 
)

Align the parent and child links of the joint being created.

Parameters
[in]_childToParentTrue to align the child to the parent, false to align the parent to the child.
[in]_axisAxis of alignment (x/y/z)
[in]_modeAlignment mode (min/center/max)
[in]_reverseTrue to reverse alignment.
static JointType gazebo::gui::JointMaker::ConvertJointType ( const std::string &  _type)
static

Convert a joint type string to enum.

Parameters
[in]_typeJoint type in string.
Returns
Joint type enum.
std::string gazebo::gui::JointMaker::CreateHotSpot ( JointData _joint)

Helper method to create hotspot visual for mouse interaction.

Parameters
[in]_jointJoint data used for creating the hotspot
Returns
Joint id, empty if hotspot creation failed.
JointData* gazebo::gui::JointMaker::CreateJoint ( const rendering::VisualPtr _parent,
const rendering::VisualPtr _child 
)

Create a joint with parent and child.

Parameters
[in]_parentParent of the joint.
[in]_childChild of the joint.
Returns
Joint data.
void gazebo::gui::JointMaker::CreateJointFromSDF ( sdf::ElementPtr  _jointElem,
const std::string &  _modelName = "" 
)

Create a joint from SDF.

This is mainly used when editing existing models.

Parameters
[in]_jointElementSDF element to load.
[in]_modelNameName of the model that contains this joint.
void gazebo::gui::JointMaker::DisableEventHandlers ( )

Disable the mouse and key event handlers for the joint maker.

void gazebo::gui::JointMaker::EmitLinkInserted ( const std::string &  _linkId)
signal

Qt signal to notify that a link has been inserted.

Parameters
[in]_linkIdLink's unique name.
void gazebo::gui::JointMaker::EmitLinkRemoved ( const std::string &  _linkId)
signal

Qt signal to notify that a link has been removed.

Parameters
[in]_linkIdLink's unique name.
void gazebo::gui::JointMaker::EnableEventHandlers ( )

Enable the mouse and key event handlers for the joint maker.

void gazebo::gui::JointMaker::FinalizeCreation ( )

Finalize joint creation.

void gazebo::gui::JointMaker::GenerateSDF ( )

Generate SDF for all joints.

void gazebo::gui::JointMaker::JointAdded ( )
signal

Qt signal when the joint creation process has ended.

static unsigned int gazebo::gui::JointMaker::JointAxisCount ( const JointMaker::JointType  _type)
static

Get the axis count for joint type.

Parameters
[in]_typeType of joint.
Returns
Axis count.
unsigned int gazebo::gui::JointMaker::JointCount ( )

Get the number of joints added.

Returns
Number of joints.
std::vector<JointData *> gazebo::gui::JointMaker::JointDataByLink ( const std::string &  _linkName) const

Get a vector containing data for all joints connected to the given link.

Parameters
[in]_linkNameName of the link.
Returns
Vector with joint data.
static std::string gazebo::gui::JointMaker::JointMaterial ( const std::string &  _type)
static

Get the material for the joint type.

Parameters
[in]_typeType of joint.
Returns
Name of material.
std::map<std::string, std::string> gazebo::gui::JointMaker::LinkList ( ) const

Get the list of links.

Returns
The list of links, with the link scoped name and leaf name.
void gazebo::gui::JointMaker::OnType ( const int  _typeInt)
slot

A new type for the joint being created has been chosen.

To be used by other classes.

Parameters
[in]_typeIntInteger corresponding to joint type enum.
void gazebo::gui::JointMaker::RemoveJoint ( const std::string &  _jointName)

Remove joint by name.

Parameters
[in]_jointNameName of joint to be removed, or an empty string to remove the new joint under creation.
void gazebo::gui::JointMaker::RemoveJointsByLink ( const std::string &  _linkName)

Remove all joints connected to link.

Parameters
[in]_linkNameName of the link.
void gazebo::gui::JointMaker::Reset ( )

Reset the joint maker;.

sdf::ElementPtr gazebo::gui::JointMaker::SDF ( ) const

Get model SDF element containing all joints.

Returns
Pointer to SDF element.
void gazebo::gui::JointMaker::SetAxis ( const std::string &  _axis,
const ignition::math::Vector3d &  _value 
)
slot

A new axis for the joint being created has been chosen.

To be used by other classes.

Parameters
[in]_axisAxis which was changed, either "axis1" or "axis2".
[in]_valueNew value for the axis
void gazebo::gui::JointMaker::SetChildLink ( const std::string &  _name)

A new child link for the joint being created has been chosen.

To be used by other classes.

See Also
SetChildLink(const rendering::VisualPtr &_childLink)
Parameters
[in]_nameLink name, either the leaf or scoped.
void gazebo::gui::JointMaker::SetJointPose ( const ignition::math::Pose3d &  _pose)

A new joint pose for the joint being created has been chosen.

To be used by other classes.

Parameters
[in]_poseNew joint pose.
void gazebo::gui::JointMaker::SetLinksRelativePose ( const ignition::math::Pose3d &  _pose,
const bool  _reset 
)

A new relative pose for the child link of the joint being created hass been chosen.

The pose is expressed in the parent link frame. This has no effect if triggered before both links are chosen.

Parameters
[in]_poseNew pose.
[in]_resetSet to true to reset the relative pose to the original one.
void gazebo::gui::JointMaker::SetParentLink ( const std::string &  _name)

A new parent link for the joint being created has been chosen.

To be used by other classes.

See Also
SetParentLink(const rendering::VisualPtr &_parentLink)
Parameters
[in]_nameLink name, either the leaf or scoped.
void gazebo::gui::JointMaker::SetSelected ( const std::string &  _name,
const bool  selected 
)

Set the select state of a joint.

Parameters
[in]_nameName of the joint.
[in]_selectedTrue to select the joint.
void gazebo::gui::JointMaker::SetSelected ( const rendering::VisualPtr _jointVis,
const bool  selected 
)

Set the select state of a joint visual.

Parameters
[in]_jointVisPointer to the joint visual.
[in]_selectedTrue to select the joint.
void gazebo::gui::JointMaker::ShowJoints ( const bool  _show)
slot

Qt Callback to show / hide joint visuals.

Parameters
[in]_showTrue to show joints, false to hide them.
JointMaker::JointType gazebo::gui::JointMaker::State ( ) const

Get state.

Returns
Current state of the joint maker. If mouse is enabled to create a new joint, it returns the type of joint. Otherwise, it returns JOINT_NONE.
void gazebo::gui::JointMaker::Stop ( )

Stop the process of adding joint to the model.

static std::string gazebo::gui::JointMaker::TypeAsString ( const JointMaker::JointType  _type)
static

Get the joint type in string.

Parameters
[in]_typeType of joint.
Returns
Joint type in string.
void gazebo::gui::JointMaker::Update ( )

Update callback on PreRender.

Member Data Documentation

std::map<JointMaker::JointType, std::string> gazebo::gui::JointMaker::jointMaterials
static

A map of joint type to its corresponding material.

std::map<JointMaker::JointType, std::string> gazebo::gui::JointMaker::jointTypes
static

A map of joint type to its string value.

std::vector<ignition::math::Vector3d> gazebo::gui::JointMaker::unitVectors
static

Constant vector containing [UnitX, UnitY, UnitZ].


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