##

JointControlWidget.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 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_JOINTCONTROLWIDGET_HH_
#define GAZEBO_GUI_JOINTCONTROLWIDGET_HH_
#include <functional>
#include <memory>
#include <string>
#include <ignition/msgs.hh>
#include <ignition/transport.hh>
#include "gazebo/gui/qt.h"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace msgs
{
class Model;
}
namespace gui
{
class JointControlWidgetPrivate;
class JointForceControl;
class JointForceControlPrivate;
class JointPIDPosControl;
class JointPIDPosControlPrivate;
class JointPIDVelControl;
class JointPIDVelControlPrivate;
class GZ_GUI_VISIBLE JointControlWidget : public QWidget
{
Q_OBJECT
public: explicit JointControlWidget(QWidget *_parent = 0);
public: virtual ~JointControlWidget();
public: void SetModelName(const std::string &_modelName);
private: void ResponseCallback(const std::string &_modelName,
const ignition::msgs::JointCmd &_rep, const bool _result);
private slots: void OnResponse(const std::string &_modelName,
const ignition::msgs::JointCmd &_rep);
Q_SIGNALS: void repReceived(const std::string &_modelName,
const ignition::msgs::JointCmd &_rep);
private slots: void OnReset();
private slots: void OnForceChanged(double _value,
const std::string &_name);
private slots: void OnPIDPosChanged(double _value,
const std::string &_name);
private slots: void OnPPosGainChanged(double _value,
const std::string &_name);
private slots: void OnDPosGainChanged(double _value,
const std::string &_name);
private slots: void OnIPosGainChanged(double _value,
const std::string &_name);
private slots: void OnPIDVelChanged(double _value,
const std::string &_name);
private slots: void OnPVelGainChanged(double _value,
const std::string &_name);
private slots: void OnDVelGainChanged(double _value,
const std::string &_name);
private slots: void OnIVelGainChanged(double _value,
const std::string &_name);
private slots: void OnPIDPosUnitsChanged(int _index);
private: void AddScrollTab(QTabWidget *_tabPane,
QGridLayout *_tabLayout,
const QString &_name);
private: void LayoutForceTab(msgs::Model &_modelMsg);
private: void LayoutPositionTab(msgs::Model &_modelMsg);
private: void LayoutVelocityTab(msgs::Model &_modelMsg);
private: std::unique_ptr<JointControlWidgetPrivate> dataPtr;
};
class GZ_GUI_VISIBLE JointForceControl : public QWidget
{
Q_OBJECT
public: JointForceControl(const std::string &_name,
QGridLayout *_layout, QWidget *_parent, int _index);
public: virtual ~JointForceControl();
public: void Reset();
public: void SetForce(const double _force);
public: void SetShowActive(const bool _active);
public slots: void OnChanged(double _value);
Q_SIGNALS: void changed(double _value, const std::string &_name);
private: std::unique_ptr<JointForceControlPrivate> dataPtr;
};
class GZ_GUI_VISIBLE JointPIDPosControl : public QWidget
{
Q_OBJECT
public: JointPIDPosControl(const std::string &_name,
QGridLayout *_layout, QWidget *_parent, int _index);
public: virtual ~JointPIDPosControl();
public: void Reset();
public: void SetPositionTarget(const double _target);
public: void SetPGain(const double _pGain);
public: void SetIGain(const double _iGain);
public: void SetDGain(const double _dGain);
public: void SetShowActive(const bool _active);
public: void SetToRadians();
public: void SetToDegrees();
public slots: void OnChanged(double _value);
public slots: void OnPChanged(double _value);
public slots: void OnIChanged(double _value);
public slots: void OnDChanged(double _value);
Q_SIGNALS: void changed(double _value, const std::string &_name);
Q_SIGNALS: void pChanged(double _value, const std::string &_name);
Q_SIGNALS: void dChanged(double _value, const std::string &_name);
Q_SIGNALS: void iChanged(double _value, const std::string &_name);
private: std::unique_ptr<JointPIDPosControlPrivate> dataPtr;
};
class GZ_GUI_VISIBLE JointPIDVelControl : public QWidget
{
Q_OBJECT
public: JointPIDVelControl(const std::string &_name,
QGridLayout *_layout, QWidget *_parent, int _index);
public: virtual ~JointPIDVelControl();
public: void Reset();
public: void SetVelocityTarget(const double _target);
public: void SetPGain(const double _pGain);
public: void SetIGain(const double _iGain);
public: void SetDGain(const double _dGain);
public: void SetShowActive(const bool _active);
public slots: void OnChanged(double _value);
public slots: void OnPChanged(double _value);
public slots: void OnIChanged(double _value);
public slots: void OnDChanged(double _value);
Q_SIGNALS: void changed(double _value, const std::string &_name);
Q_SIGNALS: void pChanged(double _value, const std::string &_name);
Q_SIGNALS: void dChanged(double _value, const std::string &_name);
Q_SIGNALS: void iChanged(double _value, const std::string &_name);
private: std::unique_ptr<JointPIDVelControlPrivate> dataPtr;
};
}
}
#endif
gazebo::gui::JointPIDVelControl::dChanged
void dChanged(double _value, const std::string &_name)
QT changed signal, used to report the change to the joint controller widget.
gazebo::gui::JointPIDPosControl::OnPChanged
void OnPChanged(double _value)
Callback when the value of P gain slider changed.
gazebo::gui::JointPIDPosControl::OnChanged
void OnChanged(double _value)
Callback when the value of position slider changed.
gazebo::gui::JointControlWidget::~JointControlWidget
virtual ~JointControlWidget()
Destructor.
gazebo::gui::JointControlWidget::repReceived
void repReceived(const std::string &_modelName, const ignition::msgs::JointCmd &_rep)
QT signal, used to report a response from the joint controller.
gazebo::gui::JointPIDPosControl::SetToDegrees
void SetToDegrees()
Set the units to degrees.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
qt.h
gazebo::gui::JointPIDVelControl::iChanged
void iChanged(double _value, const std::string &_name)
QT changed signal, used to report the change to the joint controller widget.
gazebo::gui::JointPIDPosControl::dChanged
void dChanged(double _value, const std::string &_name)
QT changed signal, used to report the change to the joint controller widget.
gazebo::gui::JointForceControl::changed
void changed(double _value, const std::string &_name)
QT changed signal, used to report the change to the joint controller widget.
gazebo::gui::JointControlWidget
Widget to control joints via application of force, position PID controller, or velocity PID controlle...
Definition: JointControlWidget.hh:49
gazebo::gui::JointPIDVelControl::SetVelocityTarget
void SetVelocityTarget(const double _target)
Set the PID target velocity.
gazebo::gui::JointPIDPosControl::OnIChanged
void OnIChanged(double _value)
Callback when the value of I gain slider changed.
system.hh
gazebo::gui::JointPIDPosControl::Reset
void Reset()
Reset the controls.
gazebo::gui::JointPIDVelControl::SetShowActive
void SetShowActive(const bool _active)
Indicate whether controls are active by highlighting them.
gazebo::gui::JointPIDVelControl::JointPIDVelControl
JointPIDVelControl(const std::string &_name, QGridLayout *_layout, QWidget *_parent, int _index)
Constructor.
gazebo::gui::JointPIDPosControl::SetDGain
void SetDGain(const double _dGain)
Set the PID derivative gain.
gazebo::gui::JointForceControl::SetShowActive
void SetShowActive(const bool _active)
Indicate whether controls are active by highlighting them.
gazebo::gui::JointPIDVelControl::Reset
void Reset()
Reset the controls.
gazebo::gui::JointPIDPosControl::OnDChanged
void OnDChanged(double _value)
Callback when the value of D gain slider changed.
gazebo::gui::JointPIDVelControl::SetDGain
void SetDGain(const double _dGain)
Set the PID derivative gain.
gazebo::gui::JointPIDPosControl::JointPIDPosControl
JointPIDPosControl(const std::string &_name, QGridLayout *_layout, QWidget *_parent, int _index)
Constructor.
gazebo::gui::JointPIDVelControl::OnIChanged
void OnIChanged(double _value)
Callback when the value of I gain slider changed.
gazebo::gui::JointPIDPosControl
Widget to control joints via application of position PID controller.
Definition: JointControlWidget.hh:215
gazebo::gui::JointPIDVelControl::SetIGain
void SetIGain(const double _iGain)
Set the PID integral gain.
gazebo::gui::JointPIDPosControl::~JointPIDPosControl
virtual ~JointPIDPosControl()
Destructor.
gazebo::gui::JointForceControl
Widget to control joints via application of force.
Definition: JointControlWidget.hh:171
gazebo::gui::JointPIDVelControl
Widget to control joints via application of a velocity PID controller.
Definition: JointControlWidget.hh:307
gazebo::gui::JointPIDPosControl::SetPGain
void SetPGain(const double _pGain)
Set the PID proportional gain.
gazebo::gui::JointForceControl::JointForceControl
JointForceControl(const std::string &_name, QGridLayout *_layout, QWidget *_parent, int _index)
Constructor.
gazebo::gui::JointPIDVelControl::~JointPIDVelControl
virtual ~JointPIDVelControl()
Destructor.
gui
gui
Definition: KeyEventHandler.hh:29
gazebo::gui::JointPIDPosControl::SetIGain
void SetIGain(const double _iGain)
Set the PID integral gain.
gazebo::gui::JointControlWidget::JointControlWidget
JointControlWidget(QWidget *_parent=0)
Constructor.
gazebo::gui::JointPIDVelControl::OnChanged
void OnChanged(double _value)
Callback when the value of velocity slider changed.
gazebo::gui::JointPIDVelControl::pChanged
void pChanged(double _value, const std::string &_name)
QT changed signal, used to report the change to the joint controller widget.
gazebo::gui::JointPIDVelControl::OnDChanged
void OnDChanged(double _value)
Callback when the value of D gain slider changed.
gazebo::gui::JointPIDPosControl::SetShowActive
void SetShowActive(const bool _active)
Indicate whether controls are active by highlighting them.
gazebo::gui::JointForceControl::OnChanged
void OnChanged(double _value)
On force changed callback.
gazebo::gui::JointForceControl::SetForce
void SetForce(const double _force)
Set the control force.
gazebo::gui::JointPIDVelControl::OnPChanged
void OnPChanged(double _value)
Callback when the value of P gain slider changed.
gazebo::gui::JointPIDVelControl::changed
void changed(double _value, const std::string &_name)
QT changed signal, used to report the change to the joint controller widget.
gazebo::gui::JointControlWidget::SetModelName
void SetModelName(const std::string &_modelName)
Set the name of the model to control.
gazebo::gui::JointPIDPosControl::SetPositionTarget
void SetPositionTarget(const double _target)
Set the PID target position.
gazebo::gui::JointForceControl::~JointForceControl
virtual ~JointForceControl()
Destructor.
gazebo::gui::JointPIDPosControl::changed
void changed(double _value, const std::string &_name)
QT changed signal, used to report the change to the joint controller widget.
gazebo::gui::JointPIDPosControl::iChanged
void iChanged(double _value, const std::string &_name)
QT changed signal, used to report the change to the joint controller widget.
gazebo::gui::JointPIDVelControl::SetPGain
void SetPGain(const double _pGain)
Set the PID proportional gain.
gazebo::gui::JointForceControl::Reset
void Reset()
Reset the controls.
gazebo::gui::JointPIDPosControl::SetToRadians
void SetToRadians()
Set the units to radians.
gazebo::gui::JointPIDPosControl::pChanged
void pChanged(double _value, const std::string &_name)
QT changed signal, used to report the change to the joint controller widget.