Commit e9424349 authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

Add thread safety.

parent e32ac15a
...@@ -150,6 +150,8 @@ namespace hpp { ...@@ -150,6 +150,8 @@ namespace hpp {
main->registerSlot("getCurrentPath", pathPlayer_); main->registerSlot("getCurrentPath", pathPlayer_);
main->registerSlot("getHppIIOPurl", this); main->registerSlot("getHppIIOPurl", this);
main->registerSlot("getHppContext", this); main->registerSlot("getHppContext", this);
main->registerSlot("getCurrentConfig", this);
main->registerSlot("setCurrentConfig", this);
main->registerSlot("getSelectedJoint", jointTreeWidget_); main->registerSlot("getSelectedJoint", jointTreeWidget_);
main->registerSignal(SIGNAL(appliedConfigAtParam(int,double)), pathPlayer_); main->registerSignal(SIGNAL(appliedConfigAtParam(int,double)), pathPlayer_);
...@@ -211,6 +213,16 @@ namespace hpp { ...@@ -211,6 +213,16 @@ namespace hpp {
config_ = c.in(); config_ = c.in();
} }
void HppWidgetsPlugin::setCurrentConfig (const hpp::floatSeq& q)
{
config_ = q;
}
hpp::floatSeq const* HppWidgetsPlugin::getCurrentConfig () const
{
return &config_;
}
bool HppWidgetsPlugin::corbaException(int jobId, const CORBA::Exception &excep) const bool HppWidgetsPlugin::corbaException(int jobId, const CORBA::Exception &excep) const
{ {
try { try {
...@@ -318,7 +330,6 @@ namespace hpp { ...@@ -318,7 +330,6 @@ namespace hpp {
ite->item->updateFromRobotConfig (config_); ite->item->updateFromRobotConfig (config_);
} }
} }
hpp::floatSeq_var c = client()->robot ()->getCurrentConfig ();
// for (std::list<std::string>::const_iterator it = jointFrames_.begin (); // for (std::list<std::string>::const_iterator it = jointFrames_.begin ();
// it != jointFrames_.end (); ++it) { // it != jointFrames_.end (); ++it) {
Ts = client()->robot()->getJointsPosition(config_, jointFrames_); Ts = client()->robot()->getJointsPosition(config_, jointFrames_);
...@@ -347,19 +358,17 @@ namespace hpp { ...@@ -347,19 +358,17 @@ namespace hpp {
void HppWidgetsPlugin::configurationValidation() void HppWidgetsPlugin::configurationValidation()
{ {
hpp::floatSeq_var q = client()->robot()->getCurrentConfig (); bool valid = false;
bool bb = false;
CORBA::Boolean_out b = bb;
CORBA::String_var report; CORBA::String_var report;
try { try {
client()->robot()->isConfigValid (q.in(), b, report); client()->robot()->isConfigValid (config_, valid, report);
} catch (const hpp::Error& e) { } catch (const hpp::Error& e) {
emit logFailure(QString (e.msg)); emit logFailure(QString (e.msg));
return; return;
} }
static QRegExp collision ("Collision between object (.*) and (.*)"); static QRegExp collision ("Collision between object (.*) and (.*)");
QStringList col; QStringList col;
if (!bb) { if (!valid) {
if (collision.exactMatch(QString::fromLocal8Bit(report))) { if (collision.exactMatch(QString::fromLocal8Bit(report))) {
CORBA::String_var robotName = client ()->robot()->getRobotName(); CORBA::String_var robotName = client ()->robot()->getRobotName();
size_t pos = strlen(robotName) + 1; size_t pos = strlen(robotName) + 1;
......
...@@ -132,6 +132,10 @@ signals: ...@@ -132,6 +132,10 @@ signals:
/// Apply the current configuration of the robot. /// Apply the current configuration of the robot.
void applyCurrentConfiguration (); void applyCurrentConfiguration ();
void setCurrentConfig (const hpp::floatSeq& q);
hpp::floatSeq const* getCurrentConfig () const;
/// Build a list of bodies in collision. /// Build a list of bodies in collision.
void configurationValidation (); void configurationValidation ();
......
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