Commit d59ee805 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Update PathPlayer interface

parent c92d888f
......@@ -21,6 +21,7 @@ namespace hpp {
QWidget (parent)
, ui_ (new ::Ui::PathPlayerWidget)
, timerId_ (0)
, velocity_ (false)
, process_ (new QProcess (this))
, showPOutput_ (new QDialog (this, Qt::Dialog | Qt::WindowCloseButtonHint | Qt::WindowMinMaxButtonsHint))
, pOutput_ (new QTextBrowser())
......@@ -192,6 +193,11 @@ namespace hpp {
}
}
void PathPlayer::setRobotVelocity (bool set)
{
velocity_ = set;
}
void PathPlayer::pathIndexChanged(int i)
{
assert (i >= 0);
......@@ -282,6 +288,18 @@ namespace hpp {
}
}
void PathPlayer::setCurrentTime (const double& param)
{
if (!pathIndex()->isEnabled()) return;
if (currentParam_ > pathLength_)
currentParam_ = pathLength_;
if (0 < currentParam_)
currentParam_ = 0;
currentParam_ = param;
pathSlider()->setSliderPosition(lengthToSlider(currentParam_));
updateConfiguration();
}
void PathPlayer::timerEvent(QTimerEvent *event)
{
if (timerId_ == event->timerId()) {
......@@ -299,6 +317,11 @@ namespace hpp {
hpp::floatSeq_var config =
plugin_->client()->problem()->configAtParam ((short unsigned int)pathIndex()->value(),currentParam_);
plugin_->client()->robot()->setCurrentConfig (config.in());
if (velocity_) {
config =
plugin_->client()->problem()->velocityAtParam ((short unsigned int)pathIndex()->value(),currentParam_);
plugin_->client()->robot()->setCurrentVelocity (config.in());
}
gepetto::gui::MainWindow::instance()->requestApplyCurrentConfiguration();
emit appliedConfigAtParam (getCurrentPath(), currentParam_);
}
......@@ -361,6 +384,7 @@ namespace hpp {
int PathPlayer::getCurrentPath() const
{
if (!pathIndex()->isEnabled()) return -1;
return pathIndex()->value();
}
} // namespace gui
......
......@@ -24,10 +24,10 @@ namespace hpp {
PathPlayer (HppWidgetsPlugin* plugin, QWidget* parent = 0);
~PathPlayer();
public slots:
/// Returns the path currently selected.
int getCurrentPath() const;
public slots:
/// Display the waypoints of a joint in the viewer.
/// The waypoints are those of the currently selected path index.
/// \param jointName name of the joint
......@@ -41,6 +41,15 @@ namespace hpp {
/// Get the number of paths in hpp and refresh the gui accordingly.
void update ();
/// Tells the path player to set the robot current velocity.
void setRobotVelocity(bool set);
/// Distance between two sampling point
double lengthBetweenRefresh () const;
/// Set the slider position
void setCurrentTime (const double& param);
protected:
/// Display the path of the jointName in the viewer.
/// The path is took from the currently selected path index.
......@@ -68,7 +77,6 @@ signals:
int lengthToSlider (double l) const;
double timeToLength (double time) const;
int timeBetweenRefresh() const;
double lengthBetweenRefresh () const;
::Ui::PathPlayerWidget* ui_;
......@@ -82,6 +90,7 @@ signals:
double pathLength_;
double currentParam_;
int timerId_;
bool velocity_;
QProcess* process_;
QDialog* showPOutput_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment