Handles the creation of joints in the model editor. More...
#include <JointMaker.hh>
Inherits QObject.
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... | |
JointData * | CreateJoint (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 | RemoveJointByUser (const std::string &_jointName) |
Remove joint by name and register user command. 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 _resetAll, const int _resetAxis=-1) |
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... | |
void | SetUserCmdManager (MEUserCmdManager *_manager) |
Set the user command manager variable. 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... | |
Handles the creation of joints in the model editor.
enum JointType |
JointMaker | ( | ) |
Constructor.
|
virtual |
Destructor.
void AddJoint | ( | const std::string & | _type | ) |
Add a joint.
[in] | _type | Type of joint to be added in string. |
void AddJoint | ( | const JointType | _type | ) |
Add a joint.
[in] | _type | Type of joint to be added |
void 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.
[in] | _name | Scoped link name. |
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.
[in] | _childToParent | True to align the child to the parent, false to align the parent to the child. |
[in] | _axis | Axis of alignment (x/y/z) |
[in] | _mode | Alignment mode (min/center/max) |
[in] | _reverse | True to reverse alignment. |
|
static |
Convert a joint type string to enum.
[in] | _type | Joint type in string. |
std::string CreateHotSpot | ( | JointData * | _joint | ) |
Helper method to create hotspot visual for mouse interaction.
[in] | _joint | Joint data used for creating the hotspot |
JointData* CreateJoint | ( | const rendering::VisualPtr & | _parent, |
const rendering::VisualPtr & | _child | ||
) |
Create a joint with parent and child.
[in] | _parent | Parent of the joint. |
[in] | _child | Child of the joint. |
void CreateJointFromSDF | ( | sdf::ElementPtr | _jointElem, |
const std::string & | _modelName = "" |
||
) |
Create a joint from SDF.
This is mainly used when editing existing models.
[in] | _jointElement | SDF element to load. |
[in] | _modelName | Name of the model that contains this joint. |
void DisableEventHandlers | ( | ) |
Disable the mouse and key event handlers for the joint maker.
|
signal |
Qt signal to notify that a link has been inserted.
[in] | _linkId | Link's unique name. |
|
signal |
Qt signal to notify that a link has been removed.
[in] | _linkId | Link's unique name. |
void EnableEventHandlers | ( | ) |
Enable the mouse and key event handlers for the joint maker.
void FinalizeCreation | ( | ) |
Finalize joint creation.
void GenerateSDF | ( | ) |
Generate SDF for all joints.
|
signal |
Qt signal when the joint creation process has ended.
|
static |
Get the axis count for joint type.
[in] | _type | Type of joint. |
unsigned int JointCount | ( | ) |
Get the number of joints added.
std::vector<JointData *> JointDataByLink | ( | const std::string & | _linkName | ) | const |
Get a vector containing data for all joints connected to the given link.
[in] | _linkName | Name of the link. |
|
static |
Get the material for the joint type.
[in] | _type | Type of joint. |
std::map<std::string, std::string> LinkList | ( | ) | const |
Get the list of links.
|
slot |
A new type for the joint being created has been chosen.
To be used by other classes.
[in] | _typeInt | Integer corresponding to joint type enum. |
void RemoveJoint | ( | const std::string & | _jointName | ) |
Remove joint by name.
[in] | _jointName | Name of joint to be removed, or an empty string to remove the new joint under creation. |
void RemoveJointByUser | ( | const std::string & | _jointName | ) |
Remove joint by name and register user command.
[in] | _jointName | Name of joint to be removed. |
void RemoveJointsByLink | ( | const std::string & | _linkName | ) |
Remove all joints connected to link.
[in] | _linkName | Name of the link. |
void Reset | ( | ) |
Reset the joint maker;.
sdf::ElementPtr SDF | ( | ) | const |
Get model SDF element containing all joints.
|
slot |
A new axis for the joint being created has been chosen.
To be used by other classes.
[in] | _axis | Axis which was changed, either "axis1" or "axis2". |
[in] | _value | New value for the axis |
void SetChildLink | ( | const std::string & | _name | ) |
A new child link for the joint being created has been chosen.
To be used by other classes.
[in] | _name | Link name, either the leaf or scoped. |
void SetJointPose | ( | const ignition::math::Pose3d & | _pose | ) |
A new joint pose for the joint being created has been chosen.
To be used by other classes.
[in] | _pose | New joint pose. |
void SetLinksRelativePose | ( | const ignition::math::Pose3d & | _pose, |
const bool | _resetAll, | ||
const int | _resetAxis = -1 |
||
) |
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.
[in] | _pose | New pose. |
[in] | _resetAll | Set to true to reset the relative pose to the original one. [in] _resetAxis Reset only the given axis 0 == x, 1 == y, 2 == z |
void SetParentLink | ( | const std::string & | _name | ) |
A new parent link for the joint being created has been chosen.
To be used by other classes.
[in] | _name | Link name, either the leaf or scoped. |
void SetSelected | ( | const std::string & | _name, |
const bool | selected | ||
) |
Set the select state of a joint.
[in] | _name | Name of the joint. |
[in] | _selected | True to select the joint. |
void SetSelected | ( | const rendering::VisualPtr & | _jointVis, |
const bool | selected | ||
) |
Set the select state of a joint visual.
[in] | _jointVis | Pointer to the joint visual. |
[in] | _selected | True to select the joint. |
void SetUserCmdManager | ( | MEUserCmdManager * | _manager | ) |
Set the user command manager variable.
[in] | _manager | Pointer to the manager. |
|
slot |
Qt Callback to show / hide joint visuals.
[in] | _show | True to show joints, false to hide them. |
JointMaker::JointType State | ( | ) | const |
Get state.
void Stop | ( | ) |
Stop the process of adding joint to the model.
|
static |
Get the joint type in string.
[in] | _type | Type of joint. |
void Update | ( | ) |
Update callback on PreRender.
|
static |
A map of joint type to its corresponding material.
|
static |
A map of joint type to its string value.
|
static |
Constant vector containing [UnitX, UnitY, UnitZ].