Skip to content
Snippets Groups Projects
Commit a5f24d90 authored by Philipp Schmidt's avatar Philipp Schmidt
Browse files

Added options what to take into account when solving ik, for example...

Added options what to take into account when solving ik, for example orientation, position, X, Y,...
parent 72355f70
No related branches found
No related tags found
No related merge requests found
......@@ -130,6 +130,18 @@ void armarx::RobotIKWidgetController::onConnectComponent()
//Make sure comboBox is enabled so you can select a kinematic chain
this->ui.comboBox->setEnabled(true);
//Get all caertesian selections and add them
this->ui.cartesianselection->addItem(QString::fromStdString("Orientation and Position"));
this->ui.cartesianselection->addItem(QString::fromStdString("Position"));
this->ui.cartesianselection->addItem(QString::fromStdString("Orientation"));
this->ui.cartesianselection->addItem(QString::fromStdString("X position"));
this->ui.cartesianselection->addItem(QString::fromStdString("Y position"));
this->ui.cartesianselection->addItem(QString::fromStdString("Z position"));
//Make sure it is enabled
this->ui.cartesianselection->setEnabled(true);
this->ui.cartesianselection->setCurrentIndex(0);
connectSlots();
enableMainWidgetAsync(true);
}
......@@ -319,6 +331,14 @@ void armarx::RobotIKWidgetController::kinematicChainChanged(const QString &arg1)
tcpManip->rotation.setValue(SbRotation(VirtualRobot::CoinVisualizationFactory::getSbMatrix(mat)));*/
}
void armarx::RobotIKWidgetController::caertesianSelectionChanged(const QString &arg1)
{
//If there is a manip in the scene we pretend it just moved to update color etc.
if(tcpManip) {
manipFinishCallback(this, NULL);
}
}
void armarx::RobotIKWidgetController::resetManip()
{
//Triggers reset of manipulator in kinematicChainChanged
......@@ -330,6 +350,7 @@ void armarx::RobotIKWidgetController::connectSlots()
connect(ui.resetManip, SIGNAL(clicked()), this, SLOT(resetManip()), Qt::QueuedConnection);
connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(solveIK()), Qt::QueuedConnection);
connect(ui.comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(kinematicChainChanged(QString)), Qt::UniqueConnection);
connect(ui.cartesianselection, SIGNAL(currentIndexChanged(QString)), this, SLOT(caertesianSelectionChanged(QString)), Qt::UniqueConnection);
}
armarx::StringList armarx::RobotIKWidgetController::getIncludePaths()
......@@ -518,8 +539,31 @@ armarx::ExtendedIKResult armarx::RobotIKWidgetController::getIKSolution()
mat (3,3) = matrix[3][3];
// mat = robot->getRootNode()->toLocalCoordinateSystem(mat);
return(robotIKPrx->computeExtendedIKGlobalPose(this->ui.comboBox->currentText().toStdString(),
new armarx::Pose(mat), eAll));
return(robotIKPrx->computeExtendedIKGlobalPose(this->ui.comboBox->currentText().toStdString(),new armarx::Pose(mat),
convertOption(this->ui.cartesianselection->currentText().toStdString())));
}
armarx::CartesianSelection armarx::RobotIKWidgetController::convertOption(std::string option)
{
if(option == "Orientation and Position") {
return eAll;
}
else if(option == "Position") {
return ePosition;
}
else if(option == "Orientation") {
return eOrientation;
}
else if(option == "X position") {
return eX;
}
else if(option == "Y position") {
return eY;
}
else if(option == "Z position") {
return eZ;
}
return eAll;
}
Q_EXPORT_PLUGIN2(armarx_gui_RobotIKGuiPlugin, armarx::RobotIKGuiPlugin)
......@@ -91,6 +91,7 @@ namespace armarx
public slots:
void solveIK();
void kinematicChainChanged(const QString &arg1);
void caertesianSelectionChanged(const QString &arg1);
void resetManip();
protected:
......@@ -133,6 +134,8 @@ namespace armarx
ExtendedIKResult getIKSolution();
CartesianSelection convertOption(std::string option);
bool startUpCameraPositioningFlag;
};
......
......@@ -55,6 +55,32 @@
<item>
<widget class="QComboBox" name="comboBox"/>
</item>
<item>
<widget class="QLabel" name="caertesianselectionlabel">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Select what to take into account when solving IK:</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cartesianselection">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment