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 
32 CSpaceVisualizerTask::CSpaceVisualizerTask(const SimoxCSpaceWith2DPoseBasePtr& cspace, const VectorXf& robotPlatform2DPose, const std::string& taskName)
33 {
34  ARMARX_CHECK_EXPRESSION(robotPlatform2DPose.size() == 3) << "The platform pose needs to contain x, y, alpha";
35  this->startCfg = robotPlatform2DPose;
36  this->goalCfg = VectorXf(3, 0);
37  this->cspace = cspace->clone();
38  SimoxCSpaceWith2DPosePtr space = SimoxCSpaceWith2DPosePtr::dynamicCast(this->cspace);
39  if (space)
40  {
41  space->setPoseBounds(Vector3fRange {{
42  startCfg.at(0) - 10000,
43  startCfg.at(1) - 10000,
44  -M_PI
45  },
46  {
47  startCfg.at(0) + 10000,
48  startCfg.at(1) + 10000,
49  M_PI
50  }
51  });
52  }
53  else
54  {
55  throw LocalException() << "The cspace needs to be a SimoxCSpaceWith2DPose";
56  }
57 
58  this->taskName = taskName;
59 
60 }
61 
62 Path armarx::CSpaceVisualizerTask::getPath(const Ice::Current&) const
63 {
64  Path p;
65  p.pathName = "RobotPose";
66  p.nodes.push_back(this->startCfg);
67  // p.nodes.push_back(this->goalCfg);
68  return p;
69 }
70 
71 void CSpaceVisualizerTask::run(const armarx::RemoteObjectNodePrxList&, const Ice::Current&)
72 {
73  setTaskStatus(TaskStatus::ePlanning);
74  cspace->initCollisionTest();
75  setTaskStatus(TaskStatus::eDone);
76 }
77 
79 {
80 
81 }
armarx::CSpaceVisualizerTask::getPath
Path getPath(const Ice::Current &=Ice::emptyCurrent) const override
Definition: CSpaceVisualizerTask.cpp:62
IceInternal::Handle
Definition: forward_declarations.h:8
space
std::string space
Definition: OrientedTactileSensorUnit.cpp:333
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:71
armarx::MotionPlanningTask::setTaskStatus
bool setTaskStatus(TaskStatus::Status newTaskStatus, const Ice::Current &=Ice::emptyCurrent) override
Definition: MotionPlanningTask.cpp:30
CSpaceVisualizerTask.h
armarx::armem::server::ltm::detail::mixin::Path
std::filesystem::path Path
Definition: DiskStorageMixin.h:17
armarx::CSpaceVisualizerTask::ice_postUnmarshal
void ice_postUnmarshal() override
Definition: CSpaceVisualizerTask.cpp:78
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28