##

ApplyWrenchDialog.hh
Go to the documentation of this file.
/*
* Copyright 2015 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_GUI_APPLYWRENCHDIALOG_HH_
#define GAZEBO_GUI_APPLYWRENCHDIALOG_HH_
#include <memory>
#include <string>
#include <ignition/math/Vector3.hh>
#include "gazebo/common/MouseEvent.hh"
#include "gazebo/gui/qt.h"
namespace gazebo
{
namespace gui
{
class ApplyWrenchDialogPrivate;
class GZ_GUI_VISIBLE ApplyWrenchDialog : public QDialog
{
Q_OBJECT
public: enum Mode
{
NONE = 0,
FORCE = 1,
TORQUE = 2
};
public: explicit ApplyWrenchDialog(QWidget *_parent = 0);
public: ~ApplyWrenchDialog();
public: void Init(const std::string &_modelName,
const std::string &_linkName);
public: void Fini();
public: Mode GetMode() const;
private: bool SetModel(const std::string &_modelName);
private: bool SetLink(const std::string &_linkName);
private slots: void SetLink(const QString _linkName);
private slots: void OnApplyAll();
private slots: void OnApplyForce();
private slots: void OnApplyTorque();
private slots: void OnCancel();
private slots: void ToggleComRadio(bool _checked);
private slots: void OnForcePosChanged(double _value);
private slots: void OnForceMagChanged(double _magnitude);
private slots: void OnForceChanged(double _value);
private slots: void OnForceClear();
private slots: void OnTorqueMagChanged(double _magnitude);
private slots: void OnTorqueChanged(double _value);
private slots: void OnTorqueClear();
private slots: void OnManipulation();
private slots: bool eventFilter(QObject *_object, QEvent *_event);
private slots: void changeEvent(QEvent *_event);
private: void SetSpinValue(QDoubleSpinBox *_spin, const double _value);
private: void SetForcePos(const ignition::math::Vector3d &_forcePos);
private: void SetForce(const ignition::math::Vector3d &_force,
const bool _rotatedByMouse = false);
private: void SetTorque(const ignition::math::Vector3d &_torque,
const bool _rotatedByMouse = false);
private: void OnPreRender();
private: void AttachVisuals();
private: void SetCoM(const ignition::math::Vector3d &_com);
private: bool OnMousePress(const common::MouseEvent &_event);
private: bool OnMouseRelease(const common::MouseEvent &_event);
private: bool OnMouseMove(const common::MouseEvent &_event);
private: void SetMode(Mode _mode);
private: void NewForceDirection(const ignition::math::Vector3d &_dir);
private: void NewTorqueDirection(const ignition::math::Vector3d &_dir);
private: void SetActive(bool _active);
private: void ActivateWindow();
private: std::unique_ptr<ApplyWrenchDialogPrivate> dataPtr;
};
}
}
#endif
gazebo::gui::ApplyWrenchDialog::GetMode
Mode GetMode() const
Get the mode, either force, torque or none.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
qt.h
gazebo::gui::ApplyWrenchDialog
Dialog for applying force and torque to a model.
Definition: ApplyWrenchDialog.hh:38
gazebo::gui::ApplyWrenchDialog::Init
void Init(const std::string &_modelName, const std::string &_linkName)
Initiate the dialog.
gazebo::gui::ApplyWrenchDialog::Mode
Mode
Definition: ApplyWrenchDialog.hh:44
gazebo::gui::ApplyWrenchDialog::Fini
void Fini()
Finish the dialog.
gazebo::gui::ApplyWrenchDialog::FORCE
Force.
Definition: ApplyWrenchDialog.hh:49
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gui
gui
Definition: KeyEventHandler.hh:29
gazebo::gui::ApplyWrenchDialog::ApplyWrenchDialog
ApplyWrenchDialog(QWidget *_parent=0)
Constructor.
gazebo::gui::ApplyWrenchDialog::~ApplyWrenchDialog
~ApplyWrenchDialog()
Destructor.
gazebo::gui::ApplyWrenchDialog::TORQUE
Torque.
Definition: ApplyWrenchDialog.hh:51
MouseEvent.hh
gazebo::common::MouseEvent
Generic description of a mouse event.
Definition: MouseEvent.hh:35
gazebo::gui::ApplyWrenchDialog::NONE
None.
Definition: ApplyWrenchDialog.hh:47