Klamp't  0.9.0
Robot.h
1 #ifndef MODELING_ROBOT_H
2 #define MODELING_ROBOT_H
3 
4 #include <KrisLibrary/robotics/RobotWithGeometry.h>
5 #include <KrisLibrary/utils/PropertyMap.h>
6 #include "ManagedGeometry.h"
7 
8 //forward declaration
9 class RobotIKFunction;
10 
11 namespace Klampt {
12  using namespace std;
13 
18 {
28  enum Type { Weld, Normal, Spin, Floating, FloatingPlanar, BallAndSocket, Closed };
29 
34  int linkIndex;
37  int baseIndex;
39  Vector3 localPt,attachmentPt;
40 };
41 
46 {
57  enum Type { Normal, Affine, Translation, Rotation, Custom };
58 
59  int NumControls() const; //number of input controls
60  int NumLinks() const;
61  bool Affects(int link) const;
62 
63  Type type;
64  vector<int> linkIndices;
65  Real qmin,qmax; //min/max values
66  Real vmin,vmax; //min/max velocities
67  Real amin,amax; //min/max accelerations
68  Real tmin,tmax; //min/max torques
69  vector<Real> affScaling; //for Affine joints
70  vector<Real> affOffset; //for Affine joints
71  Real servoP,servoI,servoD; //servo parameters
72  Real dryFriction; //constant friction coefficient
73  Real viscousFriction; //velocity-dependent friction coefficient
74 };
75 
83 class RobotModel : public RobotWithGeometry
84 {
85 public:
86  virtual std::string LinkName(int i) const;
87  int LinkIndex(const char* name) const;
88  bool Load(const char* fn);
89  bool LoadRob(const char* fn);
90  bool LoadURDF(const char* fn);
91  bool Save(const char* fn);
92  bool LoadGeometry(int i,const char* file);
93  void SetGeomFiles(const char* geomPrefix="",const char* geomExt="off");
94  void SetGeomFiles(const vector<string>& geomFiles);
95  bool SaveGeometry(const char* prefix="");
96  void InitStandardJoints();
97  bool CheckValid() const;
98  //adds a geometry to the geometry of the given link
99  void Mount(int link,const Geometry::AnyGeometry3D& geom,const RigidTransform& T);
100  //adds a subchain as descendents of a given link
101  void Mount(int link,const RobotModel& subchain,const RigidTransform& T,const char* prefix=NULL);
103  void Merge(const std::vector<RobotModel*>& robots);
109  void Reduce(RobotModel& reducedRobot,vector<int>& dofMap);
110 
111  bool DoesJointAffect(int joint,int dof) const;
112  void GetJointIndices(int joint,vector<int>& indices) const;
114  void SetJointByTransform(int joint,int link,const RigidTransform& T);
116  void SetJointByOrientation(int joint,int link,const Matrix3& R);
118  void SetJointVelocityByMoment(int joint,int link,const Vector3& w,const Vector3& v);
119 
121  bool IsPassiveDOF(int dof) const;
122  bool DoesDriverAffect(int driver,int dof) const;
123  void GetDriverIndices(int driver,vector<int>& indices) const;
124  Vector2 GetDriverLimits(int driver) const;
125  Real GetDriverValue(int driver) const;
126  Real GetDriverVelocity(int driver) const;
127  void SetDriverValue(int driver,Real value);
128  void SetDriverVelocity(int driver,Real value);
130  void GetDriverJacobian(int driver,Vector& J);
131 
135  void ComputeLipschitzMatrix();
136 
139  void ConfigureDriverConstraints(RobotIKFunction& f);
140 
141  string name;
142  vector<string> geomFiles;
143  vector<ManagedGeometry> geomManagers;
144  Vector accMax;
145  vector<RobotModelJoint> joints;
146  vector<RobotModelDriver> drivers;
147  vector<string> linkNames;
148  vector<string> driverNames;
149 
155  PropertyMap properties;
156 
159 
163 };
164 
165 } //namespace Klampt
166 
167 #endif
static bool disableGeometryLoading
Definition: Robot.h:162
Type type
The type of this joint.
Definition: Robot.h:31
Determines the effects of an actuator on the robot configuration.
Definition: Robot.h:45
Vector3 localPt
For closed joints.
Definition: Robot.h:39
Type
Definition: Robot.h:57
vector< ManagedGeometry > geomManagers
geometry loaders (speeds up loading)
Definition: Robot.h:143
PropertyMap properties
Definition: Robot.h:155
Additional joint properties.
Definition: Robot.h:17
Type
Definition: Robot.h:28
Vector accMax
conservative acceleration limits, used by DynamicPath
Definition: Robot.h:144
int baseIndex
Definition: Robot.h:37
The main robot type used in RobotSim.
Definition: Robot.h:83
Matrix lipschitzMatrix
A matrix of lipschitz constants (see ComputeLipschitzMatrix)
Definition: Robot.h:158
int linkIndex
Definition: Robot.h:34
Definition: ContactDistance.h:6
vector< string > geomFiles
geometry file names (used in saving)
Definition: Robot.h:142