CSpaceVisualizerTask.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarX
19  * @author Mirko Waechter( mirko.waechter at kit dot edu)
20  * @date 2016
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #include "CSpaceVisualizerTask.h"
25 
27 
28 
29 using namespace armarx;
30 
31 CSpaceVisualizerTask::CSpaceVisualizerTask(const SimoxCSpaceWith2DPoseBasePtr& cspace,
32  const VectorXf& robotPlatform2DPose,
33  const std::string& taskName)
34 {
35  ARMARX_CHECK_EXPRESSION(robotPlatform2DPose.size() == 3)
36  << "The platform pose needs to contain x, y, alpha";
37  this->startCfg = robotPlatform2DPose;
38  this->goalCfg = VectorXf(3, 0);
39  this->cspace = cspace->clone();
40  SimoxCSpaceWith2DPosePtr space = SimoxCSpaceWith2DPosePtr::dynamicCast(this->cspace);
41  if (space)
42  {
43  space->setPoseBounds(Vector3fRange{{startCfg.at(0) - 10000, startCfg.at(1) - 10000, -M_PI},
44  {startCfg.at(0) + 10000, startCfg.at(1) + 10000, M_PI}});
45  }
46  else
47  {
48  throw LocalException() << "The cspace needs to be a SimoxCSpaceWith2DPose";
49  }
50 
51  this->taskName = taskName;
52 }
53 
54 Path
55 armarx::CSpaceVisualizerTask::getPath(const Ice::Current&) const
56 {
57  Path p;
58  p.pathName = "RobotPose";
59  p.nodes.push_back(this->startCfg);
60  // p.nodes.push_back(this->goalCfg);
61  return p;
62 }
63 
64 void
65 CSpaceVisualizerTask::run(const armarx::RemoteObjectNodePrxList&, const Ice::Current&)
66 {
67  setTaskStatus(TaskStatus::ePlanning);
68  cspace->initCollisionTest();
69  setTaskStatus(TaskStatus::eDone);
70 }
71 
72 void
74 {
75 }
armarx::CSpaceVisualizerTask::getPath
Path getPath(const Ice::Current &=Ice::emptyCurrent) const override
Definition: CSpaceVisualizerTask.cpp:55
IceInternal::Handle
Definition: forward_declarations.h:8
space
std::string space
Definition: OrientedTactileSensorUnit.cpp:371
M_PI
#define M_PI
Definition: MathTools.h:17
SimoxCSpace.h
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
armarx::CSpaceVisualizerTask::CSpaceVisualizerTask
CSpaceVisualizerTask()=default
Ctor used by object factories.
armarx::CSpaceVisualizerTask::run
void run(const RemoteObjectNodePrxList &, const Ice::Current &=Ice::emptyCurrent) override
Does not do anything for this task.
Definition: CSpaceVisualizerTask.cpp:65
armarx::navigation::core::Path
std::vector< Pose > Path
Definition: basic_types.h:46
armarx::MotionPlanningTask::setTaskStatus
bool setTaskStatus(TaskStatus::Status newTaskStatus, const Ice::Current &=Ice::emptyCurrent) override
Definition: MotionPlanningTask.cpp:32
CSpaceVisualizerTask.h
armarx::CSpaceVisualizerTask::ice_postUnmarshal
void ice_postUnmarshal() override
Definition: CSpaceVisualizerTask.cpp:73
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27