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

Merge branch 'robotIKGui'

Conflicts:
	source/RobotAPI/components/RobotIK/RobotIK.cpp
parents 9239aa56 af6218be
No related branches found
No related tags found
No related merge requests found
......@@ -516,7 +516,6 @@ namespace armarx
void RobotIK::computeIK(VirtualRobot::RobotNodeSetPtr nodeSet, const Eigen::Matrix4f& tcpPose,
armarx::CartesianSelection cs, ExtendedIKResult& ikSolution) const
{
ikSolution.jointAngles.clear();
// For the rest of this function we need to lock access to the robot,
// because we need to make sure we read the correct result from the robot node set.
......@@ -525,24 +524,20 @@ namespace armarx
synchRobot();
GenericIKSolver ikSolver(nodeSet, JacobiProvider::eSVDDamped);
bool success = ikSolver.solve(tcpPose, convertCartesianSelection(cs), _numIKTrials);
// Read solution from node set
if (true)
{
const std::vector<RobotNodePtr> robotNodes = nodeSet->getAllRobotNodes();
BOOST_FOREACH(RobotNodePtr rnode, robotNodes)
{
NameValueMap::value_type jointPair(rnode->getName(), rnode->getJointValue());
ikSolution.jointAngles.insert(jointPair);
}
ikSolution.isReachable = true;
ikSolution.error = 0;
}
else
const std::vector<RobotNodePtr> robotNodes = nodeSet->getAllRobotNodes();
BOOST_FOREACH(RobotNodePtr rnode, robotNodes)
{
ikSolution.isReachable = false;
ikSolution.error = 0;
NameValueMap::value_type jointPair(rnode->getName(), rnode->getJointValue());
ikSolution.jointAngles.insert(jointPair);
}
//Calculate error
ikSolution.error = (nodeSet->getTCP()->getGlobalPose().block<3, 1>(0, 3) - tcpPose.block<3, 1>(0, 3)).norm();
ikSolution.isReachable = success;
// Lock is automatically released
}
......
......@@ -48,7 +48,7 @@ armarx::RobotIKGuiPlugin::RobotIKGuiPlugin()
addWidget<RobotIKWidgetController>();
}
armarx::RobotIKWidgetController::RobotIKWidgetController() : startUpCameraPositioning(true)
armarx::RobotIKWidgetController::RobotIKWidgetController() : startUpCameraPositioningFlag(true)
{
//Initialize Gui
ui.setupUi(getWidget());
......@@ -57,10 +57,9 @@ armarx::RobotIKWidgetController::RobotIKWidgetController() : startUpCameraPositi
//Alignment for ui
this->ui.verticalLayout->setAlignment(Qt::AlignTop);
//Label color
//Label color can not be set in designer, so we do it here
this->ui.reachableLabel->setStyleSheet("QLabel { color : red; }");
//Component names
robotStateComponentName = "";
robotIKComponentName = "";
......@@ -68,12 +67,15 @@ armarx::RobotIKWidgetController::RobotIKWidgetController() : startUpCameraPositi
manipSeparator = NULL;
currentSeparator = NULL;
tcpManip = NULL;
tcpCurrent = NULL;
tcpCurrentTransform = NULL;
tcpDesired = NULL;
tcpManipTransform = NULL;
tcpManipColor = NULL;
tcpManipSphere = NULL;
tcpCurrentTransform = NULL;
tcpCurrentColor = NULL;
tcpCurrentSphere = NULL;
robotUpdateSensor = NULL;
textFieldUpdateSensor = NULL;
}
void armarx::RobotIKWidgetController::onInitComponent()
......@@ -86,6 +88,7 @@ void armarx::RobotIKWidgetController::onInitComponent()
void armarx::RobotIKWidgetController::onConnectComponent()
{
//Get all proxies
robotStateComponentPrx = getProxy<RobotStateComponentInterfacePrx>(robotStateComponentName);
kinematicUnitInterfacePrx = getProxy<KinematicUnitInterfacePrx>(kinematicUnitComponentName);
robotIKPrx = getProxy<RobotIKInterfacePrx>(robotIKComponentName);
......@@ -124,55 +127,68 @@ void armarx::RobotIKWidgetController::onConnectComponent()
this->ui.comboBox->addItem(QString::fromStdString(s->getName()));
}
//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);
}
armarx::StringList armarx::RobotIKWidgetController::getIncludePaths()
void armarx::RobotIKWidgetController::onDisconnectComponent()
{
StringList includePaths;
try {
StringList packages = robotStateComponentPrx->getArmarXPackages();
packages.push_back(Application::GetProjectName());
for(const std::string &projectName : packages)
{
if(projectName.empty())
continue;
CMakePackageFinder project(projectName);
StringList projectIncludePaths;
auto pathsString = project.getDataDir();
boost::split(projectIncludePaths,
pathsString,
boost::is_any_of(";,"),
boost::token_compress_on);
includePaths.insert(includePaths.end(), projectIncludePaths.begin(), projectIncludePaths.end());
}
} catch (...)
{
ARMARX_ERROR << "Unable to retrieve robot filename." << std::endl;
}
//Stop timers
SoSensorManager* sensor_mgr = SoDB::getSensorManager();
sensor_mgr->removeTimerSensor(textFieldUpdateSensor);
sensor_mgr->removeTimerSensor(robotUpdateSensor);
return includePaths;
}
//Remove all options in comboBox
this->ui.comboBox->clear();
VirtualRobot::RobotPtr armarx::RobotIKWidgetController::loadRobot(StringList includePaths)
{
try
{
std::string rfile = robotStateComponentPrx->getRobotFilename();
ArmarXDataPath::getAbsolutePath(rfile, rfile, includePaths);
return VirtualRobot::RobotIO::loadRobot(rfile);
}
catch(...)
{
ARMARX_ERROR << "Unable to load robot from file" << std::endl;
return VirtualRobot::RobotPtr();
}
}
//Disable ui controls
this->ui.comboBox->setEnabled(false);
this->ui.moveTCP->setEnabled(false);
this->ui.reachableLabel->setEnabled(false);
this->ui.reachableLabel->setText(QString::fromStdString("No kinematic chain selected"));
this->ui.reachableLabel->setStyleSheet("QLabel { color : red; }");
this->ui.errorValue->setEnabled(false);
this->ui.errorValue->setText(QString::fromStdString("Calculated error: 0"));
this->ui.errorValue->setEnabled(false);
this->ui.pushButton->setEnabled(false);
this->ui.currentPose->setEnabled(false);
this->ui.currentPoseMatrix->setEnabled(false);
this->ui.desiredPose->setEnabled(false);
this->ui.desiredPoseMatrix->setEnabled(false);
this->ui.resetManip->setEnabled(false);
//Remove all visualization
this->ui.robotViewer->getRobotViewer()->getRootNode()->removeAllChildren();
//Reset visualization pointers
manipSeparator = NULL;
currentSeparator = NULL;
tcpManip = NULL;
tcpManipTransform = NULL;
tcpManipColor = NULL;
tcpManipSphere = NULL;
tcpCurrentTransform = NULL;
tcpCurrentColor = NULL;
tcpCurrentSphere = NULL;
robotUpdateSensor = NULL;
textFieldUpdateSensor = NULL;
void armarx::RobotIKWidgetController::onDisconnectComponent()
{
//Delete proxies
robotStateComponentPrx = NULL;
kinematicUnitInterfacePrx = NULL;
robotIKPrx = NULL;
......@@ -228,18 +244,184 @@ void armarx::RobotIKWidgetController::solveIK()
}
}
void armarx::RobotIKWidgetController::kinematicChainChanged(const QString &arg1)
{
//An item has been selected, so we can allow the user to use the ui now
//The manipulator will be set to the position of the current tcp, so this pose
//has to be reachable!
this->ui.moveTCP->setEnabled(true);
this->ui.reachableLabel->setEnabled(true);
this->ui.reachableLabel->setText(QString::fromStdString("Pose reachable!"));
this->ui.reachableLabel->setStyleSheet("QLabel { color : green; }");
this->ui.errorValue->setText(QString::fromStdString("Calculated error: 0"));
this->ui.errorValue->setEnabled(true);
this->ui.pushButton->setEnabled(true);
this->ui.currentPose->setEnabled(true);
this->ui.currentPoseMatrix->setEnabled(true);
this->ui.desiredPose->setEnabled(true);
this->ui.desiredPoseMatrix->setEnabled(true);
this->ui.resetManip->setEnabled(true);
//Remove all current tcp and desired tcp pose visualization if present
if(currentSeparator) {
this->ui.robotViewer->getRobotViewer()->getRootNode()->removeChild(currentSeparator);
}
if(manipSeparator) {
this->ui.robotViewer->getRobotViewer()->getRootNode()->removeChild(manipSeparator);
}
//Create new Visualization
manipSeparator = new SoSeparator;
currentSeparator = new SoSeparator;
tcpCurrentColor = new SoMaterial;
tcpCurrentColor->transparency = 0.6f;
tcpCurrentSphere = new SoSphere;
tcpCurrentSphere->radius = 0.06f;
tcpManipColor = new SoMaterial;
tcpManipColor->ambientColor.setValue(0, 1, 0);
tcpManipColor->transparency = 0.3f;
tcpManipSphere = new SoSphere;
tcpManipSphere->radius = 0.06f;
tcpManip = new SoTransformerManip;
//We need this null separator to remove the scale knobs
//This won't lead to memory leak, because this guy
//will be deleted when the separator itself gets removed
//from the scene graph
SoSeparator* nullSep = new SoSeparator;
//Make all scale knobs disappear
tcpManip->getDragger()->setPart("scale1", nullSep);
tcpManip->getDragger()->setPart("scale2", nullSep);
tcpManip->getDragger()->setPart("scale3", nullSep);
tcpManip->getDragger()->setPart("scale4", nullSep);
tcpManip->getDragger()->setPart("scale5", nullSep);
tcpManip->getDragger()->setPart("scale6", nullSep);
tcpManip->getDragger()->setPart("scale7", nullSep);
tcpManip->getDragger()->setPart("scale8", nullSep);
tcpManip->getDragger()->addFinishCallback(manipFinishCallback, this);
tcpCurrentTransform = new SoTransform;
tcpManipTransform = new SoTransform;
manipSeparator->addChild(tcpManipTransform);
manipSeparator->addChild(tcpManip);
manipSeparator->addChild(tcpManipColor);
manipSeparator->addChild(tcpManipSphere);
currentSeparator->addChild(tcpCurrentTransform);
currentSeparator->addChild(tcpCurrentColor);
currentSeparator->addChild(tcpCurrentSphere);
this->ui.robotViewer->getRobotViewer()->getRootNode()->insertChild(currentSeparator, 0);
this->ui.robotViewer->getRobotViewer()->getRootNode()->insertChild(manipSeparator, 0);
//Get TCP pose
Eigen::Matrix4f mat = robot->getRobotNodeSet(arg1.toStdString())->getTCP()->getGlobalPose();
mat(0, 3) /= 1000;
mat(1, 3) /= 1000;
mat(2, 3) /= 1000;
//Apply to current and desired visualizer
tcpCurrentTransform->setMatrix(VirtualRobot::CoinVisualizationFactory::getSbMatrix(mat));
tcpManipTransform->setMatrix(VirtualRobot::CoinVisualizationFactory::getSbMatrix(mat));
/*tcpManip->translation.setValue(mat(0, 3) / 1000, mat(1, 3) / 1000, mat(2, 3) / 1000);
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
kinematicChainChanged(this->ui.comboBox->currentText());
}
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()
{
StringList includePaths;
try {
StringList packages = robotStateComponentPrx->getArmarXPackages();
packages.push_back(Application::GetProjectName());
for(const std::string &projectName : packages)
{
if(projectName.empty())
continue;
CMakePackageFinder project(projectName);
StringList projectIncludePaths;
auto pathsString = project.getDataDir();
boost::split(projectIncludePaths,
pathsString,
boost::is_any_of(";,"),
boost::token_compress_on);
includePaths.insert(includePaths.end(), projectIncludePaths.begin(), projectIncludePaths.end());
}
} catch (...)
{
ARMARX_ERROR << "Unable to retrieve robot filename." << std::endl;
}
return includePaths;
}
VirtualRobot::RobotPtr armarx::RobotIKWidgetController::loadRobot(StringList includePaths)
{
try
{
std::string rfile = robotStateComponentPrx->getRobotFilename();
ArmarXDataPath::getAbsolutePath(rfile, rfile, includePaths);
return VirtualRobot::RobotIO::loadRobot(rfile);
}
catch(...)
{
ARMARX_ERROR << "Unable to load robot from file" << std::endl;
return VirtualRobot::RobotPtr();
}
}
void armarx::RobotIKWidgetController::manipFinishCallback(void* data, SoDragger* dragger) {
RobotIKWidgetController* controller = static_cast<RobotIKWidgetController*>(data);
auto targetJointAngles = controller->getIKSolution();
if(targetJointAngles.isReachable) {
//Green
controller->tcpManipColor->ambientColor.setValue(0, 1, 0);
controller->ui.reachableLabel->setText(QString::fromStdString("Pose reachable!"));
controller->ui.reachableLabel->setStyleSheet("QLabel { color : green; }");
}
else {
//Red
controller->tcpManipColor->ambientColor.setValue(1, 0, 0);
controller->ui.reachableLabel->setText(QString::fromStdString("Pose unreachable!"));
controller->ui.reachableLabel->setStyleSheet("QLabel { color : red; }");
}
//Display calculated error
controller->ui.errorValue->setText(QString::fromStdString("Calculated error: " + boost::lexical_cast<std::string>(targetJointAngles.error)));
}
void armarx::RobotIKWidgetController::robotUpdateTimerCB(void *data, SoSensor *sensor)
{
RobotIKWidgetController* controller = static_cast<RobotIKWidgetController*>(data);
if (!controller)
if (!controller || !controller->robotStateComponentPrx || !controller->robot)
return;
try
{
......@@ -254,9 +436,9 @@ void armarx::RobotIKWidgetController::robotUpdateTimerCB(void *data, SoSensor *s
controller->tcpCurrentTransform->setMatrix(VirtualRobot::CoinVisualizationFactory::getSbMatrix(tcpMatrix));
}
if(controller->startUpCameraPositioning) {
if(controller->startUpCameraPositioningFlag) {
controller->ui.robotViewer->getRobotViewer()->cameraViewAll();
controller->startUpCameraPositioning = false;
controller->startUpCameraPositioningFlag = false;
}
} catch (...){};
}
......@@ -280,7 +462,7 @@ void armarx::RobotIKWidgetController::textFieldUpdateTimerCB(void *data, SoSenso
//Therefore calculate current manipulator pose
SoGetMatrixAction* action = new SoGetMatrixAction(SbViewportRegion());
SoSearchAction sa;
sa.setNode(controller->tcpDesired);
sa.setNode(controller->tcpManipSphere);
sa.setSearchingAll( TRUE ); // Search all nodes
SoBaseKit::setSearchingChildren( TRUE ); // Even inside nodekits
sa.apply(controller->ui.robotViewer->getRobotViewer()->getRootNode());
......@@ -320,117 +502,11 @@ void armarx::RobotIKWidgetController::textFieldUpdateTimerCB(void *data, SoSenso
}
}
void armarx::RobotIKWidgetController::kinematicChainChanged(const QString &arg1)
{
this->ui.moveTCP->setEnabled(true);
this->ui.reachableLabel->setEnabled(true);
this->ui.reachableLabel->setText(QString::fromStdString("Pose reachable!"));
this->ui.reachableLabel->setStyleSheet("QLabel { color : green; }");
this->ui.pushButton->setEnabled(true);
this->ui.currentPose->setEnabled(true);
this->ui.currentPoseMatrix->setEnabled(true);
this->ui.desiredPose->setEnabled(true);
this->ui.desiredPoseMatrix->setEnabled(true);
this->ui.resetManip->setEnabled(true);
Eigen::Matrix4f mat = robot->getRobotNodeSet(arg1.toStdString())->getTCP()->getGlobalPose();
mat(0, 3) /= 1000;
mat(1, 3) /= 1000;
mat(2, 3) /= 1000;
if(currentSeparator) {
this->ui.robotViewer->getRobotViewer()->getRootNode()->removeChild(currentSeparator);
}
if(manipSeparator) {
this->ui.robotViewer->getRobotViewer()->getRootNode()->removeChild(manipSeparator);
}
manipSeparator = new SoSeparator;
currentSeparator = new SoSeparator;
tcpCurrentColor = new SoMaterial;
tcpCurrentColor->transparency = 0.6f;
tcpCurrent = new SoSphere;
tcpCurrent->radius = 0.06f;
tcpDesiredColor = new SoMaterial;
tcpDesiredColor->ambientColor.setValue(0, 1, 0);
tcpDesiredColor->transparency = 0.3f;
tcpDesired = new SoSphere;
tcpDesired->radius = 0.06f;
tcpManip = new SoTransformerManip;
SoSeparator* nullSep = new SoSeparator;
//Make all scale knobs disappear
tcpManip->getDragger()->setPart("scale1", nullSep);
tcpManip->getDragger()->setPart("scale2", nullSep);
tcpManip->getDragger()->setPart("scale3", nullSep);
tcpManip->getDragger()->setPart("scale4", nullSep);
tcpManip->getDragger()->setPart("scale5", nullSep);
tcpManip->getDragger()->setPart("scale6", nullSep);
tcpManip->getDragger()->setPart("scale7", nullSep);
tcpManip->getDragger()->setPart("scale8", nullSep);
tcpManip->getDragger()->addFinishCallback(manipFinishCallback, this);
tcpCurrentTransform = new SoTransform;
tcpManipTransform = new SoTransform;
manipSeparator->addChild(tcpManipTransform);
manipSeparator->addChild(tcpManip);
manipSeparator->addChild(tcpDesiredColor);
manipSeparator->addChild(tcpDesired);
currentSeparator->addChild(tcpCurrentTransform);
currentSeparator->addChild(tcpCurrentColor);
currentSeparator->addChild(tcpCurrent);
this->ui.robotViewer->getRobotViewer()->getRootNode()->insertChild(currentSeparator, 0);
this->ui.robotViewer->getRobotViewer()->getRootNode()->insertChild(manipSeparator, 0);
/*tcpCurrentTransform->translation.setValue(mat(0, 3) / 1000, mat(1, 3) / 1000, mat(2, 3) / 1000);
tcpCurrentTransform->rotation.setValue(SbRotation());*/
VirtualRobot::CoinVisualizationFactory::getSbMatrix(mat);
tcpCurrentTransform->setMatrix(VirtualRobot::CoinVisualizationFactory::getSbMatrix(mat));
tcpManipTransform->setMatrix(VirtualRobot::CoinVisualizationFactory::getSbMatrix(mat));
/*tcpManip->translation.setValue(mat(0, 3) / 1000, mat(1, 3) / 1000, mat(2, 3) / 1000);
tcpManip->rotation.setValue(SbRotation(VirtualRobot::CoinVisualizationFactory::getSbMatrix(mat)));*/
}
void armarx::RobotIKWidgetController::resetManip()
{
//Triggers reset of manipulator in kinematicChainChanged
kinematicChainChanged(this->ui.comboBox->currentText());
}
void armarx::RobotIKWidgetController::manipFinishCallback(void* data, SoDragger* dragger) {
RobotIKWidgetController* controller = static_cast<RobotIKWidgetController*>(data);
auto targetJointAngles = controller->getIKSolution();
if(targetJointAngles.isReachable) {
//Green
controller->tcpDesiredColor->ambientColor.setValue(0, 1, 0);
controller->ui.reachableLabel->setText(QString::fromStdString("Pose reachable!"));
controller->ui.reachableLabel->setStyleSheet("QLabel { color : green; }");
controller->ui.pushButton->setEnabled(true);
}
else {
//Red
controller->tcpDesiredColor->ambientColor.setValue(1, 0, 0);
controller->ui.reachableLabel->setText(QString::fromStdString("Pose unreachable!"));
controller->ui.reachableLabel->setStyleSheet("QLabel { color : red; }");
controller->ui.pushButton->setEnabled(false);
}
}
armarx::ExtendedIKResult armarx::RobotIKWidgetController::getIKSolution()
{
SoGetMatrixAction* action = new SoGetMatrixAction(SbViewportRegion());
SoSearchAction sa;
sa.setNode(tcpDesired);
sa.setNode(tcpManipSphere);
sa.setSearchingAll( TRUE ); // Search all nodes
SoBaseKit::setSearchingChildren( TRUE ); // Even inside nodekits
sa.apply(this->ui.robotViewer->getRobotViewer()->getRootNode());
......@@ -461,8 +537,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:
......@@ -99,28 +100,31 @@ namespace armarx
RobotIKInterfacePrx robotIKPrx;
Ui::RobotIKGuiPlugin ui;
private:
void connectSlots();
StringList getIncludePaths();
VirtualRobot::RobotPtr loadRobot(StringList includePaths);
std::string robotStateComponentName;
std::string kinematicUnitComponentName;
std::string robotIKComponentName;
QPointer<RobotIKConfigDialog> dialog;
VirtualRobot::RobotPtr robot;
StringList getIncludePaths();
VirtualRobot::RobotPtr loadRobot(StringList includePaths);
SoSeparator* manipSeparator;
SoSeparator* currentSeparator;
SoTransformerManip* tcpManip;
static void manipFinishCallback(void *data, SoDragger* manip);
SoTransform* tcpManipTransform;
SoMaterial* tcpDesiredColor;
SoSphere* tcpDesired;
SoMaterial* tcpManipColor;
SoSphere* tcpManipSphere;
SoTransform* tcpCurrentTransform;
SoMaterial* tcpCurrentColor;
SoSphere* tcpCurrent;
SoSphere* tcpCurrentSphere;
SoTimerSensor* robotUpdateSensor;
static void robotUpdateTimerCB(void *data, SoSensor *sensor);
......@@ -128,11 +132,11 @@ namespace armarx
SoTimerSensor* textFieldUpdateSensor;
static void textFieldUpdateTimerCB(void *data, SoSensor *sensor);
static void manipFinishCallback(void *data, SoDragger* manip);
ExtendedIKResult getIKSolution();
bool startUpCameraPositioning;
CartesianSelection convertOption(std::string option);
bool startUpCameraPositioningFlag;
};
typedef boost::shared_ptr<RobotIKWidgetController> RobotIKGuiPluginPtr;
......
......@@ -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">
......@@ -72,7 +98,7 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="moveTCP">
<widget class="QLabel" name="reachableLabel">
<property name="enabled">
<bool>false</bool>
</property>
......@@ -82,8 +108,16 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>15</pointsize>
</font>
</property>
<property name="text">
<string>Move TCP to pose of manipulator in the 3D Viewer:</string>
<string>No kinematic chain selected</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
......@@ -91,7 +125,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="reachableLabel">
<widget class="QLabel" name="errorValue">
<property name="enabled">
<bool>false</bool>
</property>
......@@ -107,7 +141,7 @@
</font>
</property>
<property name="text">
<string>No kinematic chain selected</string>
<string>Calculated error: 0</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
......@@ -117,6 +151,25 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="moveTCP">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Move TCP to pose of manipulator in the 3D Viewer:</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="enabled">
......
......@@ -10,7 +10,7 @@
#include <Inventor/events/SoMouseButtonEvent.h>
#include <Inventor/events/SoLocation2Event.h>
armarx::RobotViewer::RobotViewer(QWidget* widget) : SoQtExaminerViewer(widget), sceneRootNode(new SoSeparator), contentRootNode(new SoSeparator), camera(new SoOrthographicCamera)
armarx::RobotViewer::RobotViewer(QWidget* widget) : SoQtExaminerViewer(widget), sceneRootNode(new SoSeparator), contentRootNode(new SoSeparator), camera(new SoPerspectiveCamera)
{
this->setBackgroundColor(SbColor(150 / 255.0f, 150 / 255.0f, 150 / 255.0f));
this->setAccumulationBuffer(true);
......
......@@ -2,7 +2,7 @@
#define __RobotViewer_h__
/* Coin headers */
#include <Inventor/nodes/SoOrthographicCamera.h>
#include <Inventor/nodes/SoPerspectiveCamera.h>
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
namespace armarx
......@@ -18,7 +18,7 @@ namespace armarx
virtual SbBool processSoEvent(const SoEvent* const event);
SoSeparator* sceneRootNode;
SoSeparator* contentRootNode;
SoOrthographicCamera* camera;
SoPerspectiveCamera* camera;
};
}
......
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