libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
BodySurfaceSampler.hpp
1 /*
2  * BodySurfaceSampler.h
3  * BioMove3D
4  *
5  * Created by Jim Mainprice on 23/06/10.
6  * Copyright 2010 LAAS/CNRS. All rights reserved.
7  *
8  */
9 #ifndef BODY_SURFACE_SAMPLING_H
10 #define BODY_SURFACE_SAMPLING_H
11 
12 #include "p3d.h"
13 #include "environment.h"
14 
15 #include "API/Device/robot.hpp"
16 #include "API/Grids/PointCloud.hpp"
17 
18 #include "CollisionPoint.hpp"
19 
20 #include <map>
21 
22 #ifndef _P3D_H
23 typedef struct obj;
24 typedef struct env;
25 #endif
26 
28 {
29 public:
30  BodySurfaceSampler(double step);
32 
33  void computeObjectPointCloud( obj* obj, PointCloud& pointCloud, bool isRobot = false );
34  void computeStaticObjectsPointCloud();
35  void computeRobotBodiesPointCloud(Robot* rob);
36  void computeAllRobotsBodiesPointCloud();
37 
38  bool isPointInEnvironment( const Eigen::Vector3d& point );
39  bool isPointOverGround( const Eigen::Vector3d& point );
40 
41  // Access to the sampled point cloud
42  // Given a robot object
43  PointCloud& getPointCloud(obj* o)
44  {
45  return *m_objectToPointCloudMap[o];
46  }
47 
48  BoundingCylinder* generateBoudingCylinder(p3d_obj* obj);
49 
51  double generateRobotBoudingCylinder(Robot* rob, const std::vector<Joint*>& activeJoints);
53 
54  // Generate collision points
55  std::vector<CollisionPoint> getLinksCollisionPoints(Joint* jnt, int segment_number , const std::vector<int>& parent_joints );
56  std::vector<CollisionPoint> generateJointCollisionPoints(Robot* robot, int id, const std::vector<int>& active_joints, const std::vector<int>& planner_joints);
57  std::vector<CollisionPoint> generateRobotCollisionPoints(Robot* robot, const std::vector<int>& active_joints, const std::vector<int>& planner_joints);
58  std::vector<CollisionPoint> generateAllRobotCollisionPoints(Robot* robot);
59 
60  // Access a collision point vector
61  // Given a joint
62  std::vector<CollisionPoint>& getCollisionPoints(Joint* jnt)
63  {
64  return m_jointToCollisionPoint[jnt];
65  }
66 
67  double getDefaultClearance() { return m_collision_clearance_default; }
68 
69  void draw();
70 
71 private:
72  env* m_env;
73  double m_step;
74 
75  std::map<obj*,PointCloud*> m_objectToPointCloudMap;
76 
77  PointCloud m_staticPoints;
78  std::vector<PointCloud*> m_robotsPoints;
79 
80  std::map<obj*,BoundingCylinder*> m_objectToBoCylinderMap;
81  std::map<Joint*, std::vector<CollisionPoint> > m_jointToCollisionPoint;
82 
83  double m_collision_clearance_default;
84 };
85 
86 #endif
std::vector< CollisionPoint > generateRobotCollisionPoints(Robot *robot, const std::vector< int > &active_joints, const std::vector< int > &planner_joints)
Generate the collision points for links associated to the active joints It computes the parent joints...
Definition: BodySurfaceSampler.cpp:379
std::vector< CollisionPoint > generateAllRobotCollisionPoints(Robot *robot)
Generate the collision points for links associated to the active joints It computes the parent joints...
Definition: BodySurfaceSampler.cpp:351
void draw()
Draw the sampled points Sampled points are points on the surface of static obstacles collision points...
Definition: BodySurfaceSampler.cpp:414
void computeObjectPointCloud(obj *obj, PointCloud &pointCloud, bool isRobot=false)
Computes a point cloud for an object.
Definition: BodySurfaceSampler.cpp:55
Definition: CollisionPoint.hpp:22
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
double generateRobotBoudingCylinder(Robot *rob, const std::vector< Joint * > &activeJoints)
returns the max radius
Definition: BodySurfaceSampler.cpp:233
std::vector< CollisionPoint > getLinksCollisionPoints(Joint *jnt, int segment_number, const std::vector< int > &parent_joints)
Generates the collision point for a given link Stores the segment number (the id of the joint for pla...
Definition: BodySurfaceSampler.cpp:262
This class holds a Joint and is associated with a Body (Link) It's the basic element of a kinematic c...
Definition: joint.hpp:27
std::vector< CollisionPoint > generateJointCollisionPoints(Robot *robot, int id, const std::vector< int > &active_joints, const std::vector< int > &planner_joints)
Computes the parent joints, the segment of the joint and generate the collision point for the joint s...
Definition: BodySurfaceSampler.cpp:311
! Vector of 3d points that can be ploted in the 3d viewer as cubes very fast ! the points are stored ...
Definition: PointCloud.hpp:15
void generateAllRobotsBoundingCylinders()
Computes collision points for all bodies.
Definition: BodySurfaceSampler.cpp:296
Definition: BodySurfaceSampler.hpp:27