Go to the documentation of this file.
31 #include <VirtualRobot/CollisionDetection/CDManager.h>
32 #include <VirtualRobot/Robot.h>
33 #include <VirtualRobot/SceneObjectSet.h>
34 #include <VirtualRobot/XML/RobotIO.h>
38 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
42 #include <RobotComponents/interface/components/MotionPlanning/CSpace/SimoxCSpace.h>
47 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
76 SimoxCSpace(memoryx::CommonStorageInterfacePrx commonStoragePrx,
78 float stationaryObjectMargin = 0.0f);
86 const Ice::Current& = Ice::emptyCurrent)
override;
92 void setAgent(
const AgentPlanningInformation& agentInfo,
93 const Ice::Current& = Ice::emptyCurrent)
override;
101 memoryx::WorkingMemoryInterfacePrx workingMemoryPrx,
102 const std::vector<std::string>& excludedInstancesIds = std::vector<std::string>());
110 memoryx::CommonStorageInterfacePrx commonStoragePrx,
125 clone(
const Ice::Current& = Ice::emptyCurrent)
override
142 bool isCollisionFree(const ::std::pair<const Ice::Float*, const Ice::Float*>& cfg,
143 const Ice::Current& = Ice::emptyCurrent)
override;
170 virtual void setConfig(
const float*& it);
182 const StationaryObjectList&
185 return stationaryObjects;
188 const AgentPlanningInformation&
197 const VirtualRobot::SceneObjectSetPtr&
212 VirtualRobot::CDManager&
222 bool checkForNonexistenJointsInCspace =
false)
const;
238 std::vector<armarx::DebugDrawerLineSet>
240 const std::vector<std::string>& nodeNames,
241 float traceStepSize = std::numeric_limits<float>::infinity())
246 std::vector<armarx::DebugDrawerLineSet>
248 const std::vector<std::string>& nodeNames,
249 float traceStepSize = std::numeric_limits<float>::infinity())
254 std::vector<armarx::DebugDrawerLineSet>
256 const std::vector<std::string>& nodeNames,
257 float traceStepSize = std::numeric_limits<float>::infinity());
262 return stationaryObjectMargin;
270 this->stationaryObjectMargin = stationaryObjectMargin;
274 ARMARX_ERROR <<
"Could not set stationary object margin, because the cSpace is "
275 "already initialized.";
286 template <
class IceBaseClass,
class DerivedClass>
289 const std::vector<VirtualRobot::RobotNodePtr>&
320 VirtualRobot::CDManager
cd;
326 new VirtualRobot::SceneObjectSet{
"StationaryObjectSet"}};
337 std::pair<VirtualRobot::RobotIO::RobotDescription, std::string>>
358 std::vector<VirtualRobot::RobotNodePtr>
joints;
392 VirtualRobot::ManipulationObjectPtr
396 VirtualRobot::CollisionCheckerPtr
const& colChecker =
397 VirtualRobot::CollisionCheckerPtr{})
const;
404 VirtualRobot::ManipulationObjectPtr
406 const armarx::PoseBasePtr& pose,
414 class SimoxCSpaceWith2DPose;
422 virtual public SimoxCSpaceWith2DPoseBase
427 float stationaryObjectMargin = 0.0f);
432 poseBounds = newBounds;
457 void setConfig(
const float*& it)
override;
460 template <
class IceBaseClass,
class DerivedClass>
476 virtual public SimoxCSpaceWith3DPoseBase
481 float stationaryObjectMargin = 0.0f);
486 poseBounds = newBounds;
509 void setConfig(
const float*& it)
override;
514 template <
class IceBaseClass,
class DerivedClass>
std::vector< armarx::DebugDrawerLineSet > getTraceVisu(const PathWithCost &p, const std::vector< std::string > &nodeNames, float traceStepSize=std::numeric_limits< float >::infinity())
void setConfig(const float *&it) override
void setConfig(const float *&it) override
virtual TrajectoryPtr pathToTrajectory(const PathWithCost &p) const
FloatRangeSeq getDimensionsBounds(const Ice::Current &=Ice::emptyCurrent) const override
AgentData getAgentDataAndLoadRobot() const
SimoxCSpaceWith3DPose()=default
bool isCollisionFree(const ::std::pair< const Ice::Float *, const Ice::Float * > &config, const Ice::Current &=Ice::emptyCurrent) override=0
AgentData getAgentDataFromRobot(VirtualRobot::RobotPtr robotPtr) const
std::vector< VirtualRobot::RobotNodePtr > joints
The agent's joints.
const VirtualRobot::RobotPtr & getAgentSceneObj() const
MatrixXX< 4, 4, float > Matrix4f
VirtualRobot::RobotPtr agent
The agent's collision model.
virtual TrajectoryPtr pathToTrajectory(const Path &p) const
bool isInitialized
Whether the collision check is initialized.
void setStationaryObjectMargin(float stationaryObjectMargin)
Similar to armarx::SimoxCSpace, but prepends dimensions for translation in x and y and a rotation aro...
Implementation of the slice class CSpaceBase.
Eigen::Matrix4f globalPoseBuffer
std::vector< armarx::DebugDrawerLineSet > getTraceVisu(const Path &p, const std::vector< std::string > &nodeNames, float traceStepSize=std::numeric_limits< float >::infinity())
ConvexHull< Point >::type convexHull(const std::vector< Point > &points)
Eigen::Matrix4f globalPoseBuffer
std::shared_ptr< class RobotPool > RobotPoolPtr
std::vector< VirtualRobot::SceneObjectSetPtr > collisionSets
The collision stes.
void setPoseBounds(const Vector3fRange &newBounds)
VirtualRobot::CDManager & getCD()
void initStationaryObjects()
Initializes stationary objects for collision checking.
virtual void addObjectsFromWorkingMemory(memoryx::WorkingMemoryInterfacePrx workingMemoryPrx, const std::vector< std::string > &excludedInstancesIds=std::vector< std::string >())
Adds all objects except the ones with ids specified in the parameter excludedInstancesIds from the wo...
virtual Saba::CSpaceSampledPtr createSimoxCSpace() const
float getStationaryObjectMargin() const
FloatRangeSeq getDimensionsBounds(const Ice::Current &=Ice::emptyCurrent) const override
memoryx::GridFileManagerPtr fileManager
The file manager used to load objects.
FloatRangeSeq getDimensionsBounds(const Ice::Current &=Ice::emptyCurrent) const override
std::vector< std::vector< Eigen::Vector3f > > stationaryPlanes
void Identity(MatrixXX< N, N, T > *a)
GlobalCache< RobotPoolPtr, std::pair< VirtualRobot::RobotIO::RobotDescription, std::string > > robotCache
CSpaceBasePtr clone(const Ice::Current &=Ice::emptyCurrent) override
Ice::Long getDimensionality(const Ice::Current &=Ice::emptyCurrent) const override
const VirtualRobot::SceneObjectSetPtr & getStationaryObjectSet() const
virtual Ice::StringSeq getAgentJointNames() const
void ice_postUnmarshal() override
Initializes basic structures after transmission through ice.
const AgentPlanningInformation & getAgent() const
virtual void addPlanarObject(const std::vector< Eigen::Vector3f > &convexHull)
const std::vector< VirtualRobot::RobotNodePtr > & getAgentJoints() const
void setAgent(const AgentPlanningInformation &agentInfo, const Ice::Current &=Ice::emptyCurrent) override
Adds a stationary agent to the cspace.
static SimoxCSpacePtr PrefetchWorkingMemoryObjects(memoryx::WorkingMemoryInterfacePrx workingMemoryPrx, memoryx::CommonStorageInterfacePrx commonStoragePrx, RobotStateComponentInterfacePrx rsc)
Load objects from WorkingMemory and puts them into the mesh cache.
void addStationaryObject(const StationaryObject &obj, const Ice::Current &=Ice::emptyCurrent) override
Adds a stationary object to the cspace.
VirtualRobot::ManipulationObjectPtr getMovedSimoxManipulatorObject(const memoryx::ObjectClassBasePtr &object, const armarx::PoseBasePtr &pose, memoryx::GridFileManagerPtr &fileManager) const
void initCollisionTest(const Ice::Current &=Ice::emptyCurrent) override
Initializes the collision test.
Ice::StringSeq getAgentJointNames() const override
SimoxCSpaceWith2DPose()=default
Ice::StringSeq getAgentJointNames() const override
void setPoseBounds(const Vector6fRange &newBounds)
Contains information about an agent.
GlobalCache< VirtualRobot::ManipulationObjectPtr, std::pair< int, std::string > > meshCache
virtual void setConfig(const float *&&it)
CSpaceBasePtr clone(bool loadVisualizationModel) override
VectorXf jointMapToVector(const std::map< std::string, float > &jointMap, bool checkForNonexistenJointsInCspace=false) const
std::shared_ptr< GridFileManager > GridFileManagerPtr
VirtualRobot::SceneObjectSetPtr stationaryObjectSet
The scene objects for stationary objects.
CSpaceBasePtr clone(bool loadVisualizationModel) override
Similar to armarx::SimoxCSpace, but prepends dimensions for translation in x, y and z and rotations a...
virtual void setStationaryObjects(const StationaryObjectList &objList)
bool loadVisualizationModel
Whether the visualization model of objects/agents sould be loaded.
VirtualRobot::CDManager cd
The collision checker.
VirtualRobot::RobotPtr agentSceneObj
std::filesystem::path Path
void initAgent(VirtualRobot::RobotPtr robotPtr)
virtual void setConfig(const std::vector< float > cfg)
Sets a configuration to check for.
The SimoxCSpace contains a set of stationary obstacles and an agent.
bool isCollisionFree(const ::std::pair< const Ice::Float *, const Ice::Float * > &cfg, const Ice::Current &=Ice::emptyCurrent) override
SimoxCSpace()=default
Default ctor.
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::vector< VirtualRobot::RobotNodePtr > agentJoints
Ice::Long getDimensionality(const Ice::Current &=Ice::emptyCurrent) const override
const StationaryObjectList & getStationaryObjects() const
std::shared_ptr< class Robot > RobotPtr
Ice::Long getDimensionality(const Ice::Current &=Ice::emptyCurrent) const override
VirtualRobot::ManipulationObjectPtr getSimoxManipulatorObject(const memoryx::ObjectClassBasePtr &object, const memoryx::GridFileManagerPtr &fileManager, bool inflate=true, VirtualRobot::CollisionCheckerPtr const &colChecker=VirtualRobot::CollisionCheckerPtr{}) const