Commit 6bec8aef authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel

Fix creation of locked joints.

parent 7c448ca8
......@@ -33,7 +33,6 @@ GEPETTO_GUI_PLUGIN(hppmanipulationwidgetsplugin
linkwidget.hh
manipulationconstraintwidget.hh
manipulationncpicker.hh
manipulationlockedjoint.hh
HEADERS_NO_MOC
roadmap.hh
......@@ -47,7 +46,6 @@ GEPETTO_GUI_PLUGIN(hppmanipulationwidgetsplugin
linkwidget.cc
manipulationconstraintwidget.cc
manipulationncpicker.cc
manipulationlockedjoint.cc
LINK_DEPENDENCIES
hppwidgetsplugin
......
......@@ -21,7 +21,7 @@
#include "hppmanipulationwidgetsplugin/linkwidget.hh"
#include "hppmanipulationwidgetsplugin/manipulationconstraintwidget.hh"
#include "hppwidgetsplugin/twojointsconstraint.hh"
#include "hppmanipulationwidgetsplugin/manipulationlockedjoint.hh"
#include "hppwidgetsplugin/listjointconstraint.hh"
using CORBA::ULong;
......@@ -521,7 +521,7 @@ namespace hpp {
constraintWidget_->addConstraint(new PositionConstraint(this));
constraintWidget_->addConstraint(new OrientationConstraint(this));
constraintWidget_->addConstraint(new TransformConstraint(this));
constraintWidget_->addConstraint(new ManipulationLockedJoint(this));
constraintWidget_->addConstraint(new LockedJointConstraint(this));
}
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
......
//
// Copyright (c) CNRS
// Authors: Joseph Mirabel and Heidy Dallard
//
#include "hppmanipulationwidgetsplugin.hh"
#include "manipulationlockedjoint.hh"
#include <QListWidgetItem>
namespace hpp {
namespace gui {
ManipulationLockedJoint::ManipulationLockedJoint(HppManipulationWidgetsPlugin* plugin)
: ListJointConstraint(plugin)
{
}
ManipulationLockedJoint::~ManipulationLockedJoint()
{
}
QString ManipulationLockedJoint::getName() const
{
return "Locked Joint";
}
void ManipulationLockedJoint::operator ()(QString const& /*name*/) {
QList<QListWidgetItem*> selected = jointList_->selectedItems();
HppManipulationWidgetsPlugin* plugin = dynamic_cast<HppManipulationWidgetsPlugin*>(plugin_);
foreach (QListWidgetItem *item, selected) {
std::string jointName = item->text().toStdString().c_str();
hpp::floatSeq_var config = plugin->client()->robot()->getJointConfig(jointName.c_str());
plugin->client()->problem()->createLockedJoint(std::string("lock_" + jointName).c_str(),
jointName.c_str(),
config.in());
emit constraintCreated(std::string("lock_" + jointName).c_str());
}
}
}
}
//
// Copyright (c) CNRS
// Authors: Joseph Mirabel and Heidy Dallard
//
#ifndef HPP_GUI_MANIPULATIONLOCKEDJOINT_HH
#define HPP_GUI_MANIPULATIONLOCKEDJOINT_HH
#include "hppwidgetsplugin/listjointconstraint.hh"
namespace hpp {
namespace gui {
class HppManipulationWidgetsPlugin;
class ManipulationLockedJoint : public ListJointConstraint
{
Q_OBJECT
public:
ManipulationLockedJoint(HppManipulationWidgetsPlugin* plugin);
virtual ~ManipulationLockedJoint();
virtual QString getName() const;
virtual void operator()(QString const& name);
};
}
}
#endif // HPP_GUI_MANIPULATIONLOCKEDJOINT_HH
......@@ -63,9 +63,13 @@ namespace hpp {
QList<QListWidgetItem *> selected = jointList_->selectedItems();
foreach(QListWidgetItem* item, selected) {
const char* jointName = item->text().toStdString().c_str();
hpp::floatSeq_var config = plugin_->client()->robot()->getJointConfig(jointName);
plugin_->client()->problem()->lockJoint(jointName, config.in());
std::string jointName = item->text().toStdString();
std::string lockName = "lock_" + jointName;
hpp::floatSeq_var config = plugin_->client()->robot()->getJointConfig(jointName.c_str());
plugin_->client()->problem()->createLockedJoint(lockName.c_str(),
jointName.c_str(),
config.in());
emit constraintCreated(lockName.c_str());
}
}
}
......
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