alrobotmodel
2.0.6.8
|
00001 00005 #ifndef ALROBOTMODEL_H 00006 #define ALROBOTMODEL_H 00007 00008 #include <almath/types/altransform.h> 00009 #include <almath/types/alposition3d.h> 00010 #include <string> 00011 00012 #include <qi/macro.hpp> 00013 00014 #ifdef alrobotmodel_EXPORTS 00015 # define ALROBOTMODEL_API QI_EXPORT_API 00016 #elif defined(alrobotmodel_IMPORTS) 00017 # define ALROBOTMODEL_API QI_IMPORT_API 00018 #else 00019 # define ALROBOTMODEL_API 00020 #endif 00021 00022 namespace Sim 00023 { 00024 00025 class Actuator; 00026 class ActuatorGroup; 00027 class AngleActuator; 00028 class AngleSensor; 00029 class AngleSpeedActuator; 00030 class AngleSpeedSensor; 00031 class ArrayDepthSensor; 00032 class BumperSensor; 00033 class CameraSensor; 00034 class CameraDepthSensor; 00035 class CoupledActuator; 00036 class CoupledSensor; 00037 class FSRSensor; 00038 class InertialSensor; 00039 class SonarSensor; 00040 class TactileSensor; 00041 class LEDActuator; 00042 class MicrophoneSensor; 00043 class Joint; 00044 class JointGroup; 00045 class JointSymmetry; 00046 class Link; 00047 class Sensor; 00048 class SingleDepthSensor; 00049 class TorqueActuator; 00050 class TorqueSensor; 00051 class WheelTorqueActuator; 00052 class WheelVelocityActuator; 00053 class WheelVelocitySensor; 00054 00055 typedef SingleDepthSensor DepthInfraredSensor; 00056 00059 class ALROBOTMODEL_API Model 00060 { 00061 public: 00062 00067 Model(const std::string& pathToModel); 00069 ~Model(); 00070 00072 const std::string& name() const; 00073 00076 const std::string& configFile() const; 00077 00080 std::vector<const Joint*> joints() const; 00083 const Joint* joint(const std::string& jointName) const; 00084 00087 std::vector<const JointSymmetry*> jointSymmetries() const; 00090 const JointSymmetry* jointSymmetry(const std::string& jointName) const; 00091 00094 std::vector<const JointGroup*> jointGroups() const; 00097 const JointGroup* jointGroup(const std::string& jointGroupName) const; 00102 std::vector<const JointGroup*> 00103 jointGroupsOfJoint(const std::string& jointName) const; 00104 00107 std::vector<const Link*> links() const; 00110 const Link* link(const std::string& linkName) const; 00114 const Link* rootLink() const; 00115 00118 std::vector<const Actuator*> actuators() const; 00121 const Actuator* actuator(const std::string& actuatorName) const; 00122 00125 std::vector<const ActuatorGroup*> actuatorGroups() const; 00128 const ActuatorGroup* actuatorGroup( 00129 const std::string& actuatorGroupName) const; 00135 std::vector<const ActuatorGroup*> 00136 actuatorGroupsOfJoint(const std::string& jointName) const; 00137 00140 std::vector<const AngleActuator*> angleActuators() const; 00143 const AngleActuator* angleActuator(const std::string& actuatorName) const; 00144 00147 std::vector<const CoupledActuator*> coupledActuators() const; 00150 const CoupledActuator* coupledActuator( 00151 const std::string& actuatorName) const; 00152 00155 std::vector<const TorqueActuator*> torqueActuators() const; 00158 const TorqueActuator* torqueActuator( 00159 const std::string& actuatorName) const; 00160 00163 std::vector<const AngleSpeedActuator*> angleSpeedActuators() const; 00166 const AngleSpeedActuator* angleSpeedActuator( 00167 const std::string& actuatorName) const; 00168 00171 std::vector<const WheelTorqueActuator*> wheelTorqueActuators() const; 00174 const WheelTorqueActuator* wheelTorqueActuator( 00175 const std::string& actuatorName) const; 00176 00179 std::vector<const WheelVelocityActuator*> wheelVelocityActuators() const; 00182 const WheelVelocityActuator* wheelVelocityActuator( 00183 const std::string& actuatorName) const; 00184 00189 std::vector<const LEDActuator*> ledActuators( 00190 const std::string& groupName = std::string()) const; 00193 const LEDActuator* ledActuator(const std::string& actuatorName) const; 00194 00197 std::vector<const Sensor*> sensors() const; 00200 const Sensor* sensor(const std::string& sensorName) const; 00201 00204 std::vector<const AngleSensor*> angleSensors() const; 00207 const AngleSensor* angleSensor(const std::string& sensorName) const; 00208 00211 std::vector<const CoupledSensor*> coupledSensors() const; 00214 const CoupledSensor* coupledSensor(const std::string& sensorName) const; 00215 00218 std::vector<const TorqueSensor*> torqueSensors() const; 00221 const TorqueSensor* torqueSensor(const std::string& sensorName) const; 00222 00225 std::vector<const AngleSpeedSensor*> angleSpeedSensors() const; 00228 const AngleSpeedSensor* angleSpeedSensor( 00229 const std::string& sensorName) const; 00230 00233 std::vector<const WheelVelocitySensor*> wheelVelocitySensors() const; 00236 const WheelVelocitySensor* wheelVelocitySensor( 00237 const std::string& sensorName) const; 00238 00241 std::vector<const CameraSensor*> cameraSensors() const; 00244 const CameraSensor* cameraSensor(const std::string& sensorName) const; 00245 00248 std::vector<const CameraDepthSensor*> cameraDepthSensors() const; 00251 const CameraDepthSensor* cameraDepthSensor( 00252 const std::string& sensorName) const; 00253 00256 std::vector<const FSRSensor*> fsrSensors() const; 00259 const FSRSensor* fsrSensor(const std::string& sensorName) const; 00260 00263 std::vector<const InertialSensor*> inertialSensors() const; 00266 const InertialSensor* inertialSensor(const std::string& sensorName) const; 00267 00270 std::vector<const SonarSensor*> sonarSensors() const; 00273 const SonarSensor* sonarSensor(const std::string& sensorName) const; 00274 00277 std::vector<const BumperSensor*> bumperSensors() const; 00280 const BumperSensor* bumperSensor(const std::string& sensorName) const; 00281 00284 std::vector<const TactileSensor*> tactileSensors() const; 00287 const TactileSensor* tactileSensor(const std::string& sensorName) const; 00288 00291 std::vector<const SingleDepthSensor*> singleDepthSensors() const; 00294 const SingleDepthSensor* singleDepthSensor( 00295 const std::string& sensorName) const; 00296 00299 std::vector<const ArrayDepthSensor*> arrayDepthSensors() const; 00302 const ArrayDepthSensor* arrayDepthSensor( 00303 const std::string& sensorName) const; 00304 00308 std::vector<const DepthInfraredSensor*> depthInfraredSensors() const; 00312 const DepthInfraredSensor* depthInfraredSensor( 00313 const std::string& sensorName) const; 00314 00317 std::vector<const MicrophoneSensor*> microphoneSensors() const; 00320 const MicrophoneSensor* microphoneSensor( 00321 const std::string& sensorName) const; 00322 00324 class ModelImpl* a_impl; 00325 }; 00326 00329 class ALROBOTMODEL_API JointSymmetry 00330 { 00331 00332 public: 00333 00337 JointSymmetry(); 00338 00340 ~JointSymmetry(); 00341 00343 enum SymmetryType 00344 { 00345 MIRROR_SYM, 00346 MIRROR_ANTISYM, 00347 }; 00348 00350 std::pair<const Joint*, const Joint*> symmetricJoints() const; 00351 00353 const Joint* symmetricJoint(const Joint* joint) const; 00354 00356 SymmetryType symmetryType() const; 00357 00359 class JointSymmetryImpl* a_impl; 00360 00361 }; 00362 00366 class ALROBOTMODEL_API JointGroup 00367 { 00368 00369 public: 00370 00374 JointGroup(); 00375 00377 ~JointGroup(); 00378 00380 const std::string& name() const; 00381 00383 std::vector<const Joint*> joints() const; 00384 00386 class JointGroupImpl* a_impl; 00387 }; 00388 00391 class ALROBOTMODEL_API Frame 00392 { 00393 public: 00396 Frame(); 00398 ~Frame(); 00400 const std::string& name() const; 00405 const AL::Math::Transform& position() const; 00407 const Frame* parentFrame() const; 00411 const AL::Math::Transform& localPosition() const; 00416 static AL::Math::Transform globalPosition( 00417 const Frame* frame); 00419 class FrameImpl* a_impl; 00420 }; 00421 00424 class ALROBOTMODEL_API Joint 00425 { 00426 public: 00429 Joint(); 00431 ~Joint(); 00435 const Frame* frame() const; 00437 const std::string& name() const; 00442 const Link* parentLink() const; 00447 const Link* childLink() const; 00449 class JointImpl* a_impl; 00450 }; 00451 00455 ALROBOTMODEL_API bool frictionCoeff( 00456 const std::string& frictionMaterial1, 00457 const std::string& frictionMaterial2, 00458 float& frictionCoeff); 00459 00463 class ALROBOTMODEL_API MassData 00464 { 00465 public: 00469 MassData(); 00471 virtual ~MassData(); 00473 float mass() const; 00478 const AL::Math::Position3D& CoM() const; 00481 const std::vector<float>& inertiaMatrix() const; 00483 class MassDataImpl* a_impl; 00484 }; 00485 00489 class ALROBOTMODEL_API VisualData 00490 { 00491 public: 00495 VisualData(); 00497 virtual ~VisualData(); 00504 const std::string& meshPath() const; 00507 const AL::Math::Transform& meshTransform() const; 00509 class VisualDataImpl* a_impl; 00510 }; 00511 00514 class ALROBOTMODEL_API Link 00515 { 00516 public: 00519 enum LinkType 00520 { 00521 CLASSIC, 00522 WHEEL_OMNI, 00523 }; 00526 Link(); 00528 virtual ~Link(); 00534 const Frame* frame() const; 00536 const std::string& name() const; 00539 const Joint* parentJoint() const; 00542 const std::vector<const Joint*> childrenJoints() const; 00544 const MassData* mass() const; 00546 const std::string& frictionMaterial() const; 00548 const VisualData* visual() const; 00550 LinkType type() const; 00552 class LinkImpl* a_impl; 00553 }; 00554 00558 class ALROBOTMODEL_API Actuator 00559 { 00560 public: 00562 enum Type 00563 { 00564 ANGLE_MOTOR, 00565 COUPLED_MOTOR, 00566 TORQUE_MOTOR, 00567 ANGLE_SPEED_MOTOR, 00568 WHEEL_TORQUE, 00569 WHEEL_VELOCITY, 00571 LED, 00572 00573 }; 00575 Actuator(class ActuatorImpl* impl); 00577 Actuator(const Actuator& other); 00579 ~Actuator(); 00581 const Frame* frame() const; 00583 const virtual std::string& name() const; 00585 Type type() const; 00588 virtual int bufferSize() const = 0; 00590 ActuatorImpl* a_impl; 00591 }; 00592 00596 class ALROBOTMODEL_API ActuatorGroup 00597 { 00598 00599 public: 00600 00604 ActuatorGroup(); 00605 00607 ~ActuatorGroup(); 00608 00610 const std::string& name() const; 00611 00613 const ActuatorGroup * parent() const; 00614 00616 std::vector<const Actuator*> actuators() const; 00617 00619 class ActuatorGroupImpl* a_impl; 00620 00621 }; 00622 00626 class ALROBOTMODEL_API DCMActuator: public Actuator 00627 { 00628 public: 00630 DCMActuator(class DCMActuatorImpl* impl); 00632 DCMActuator(const DCMActuator& other); 00634 ~DCMActuator(); 00637 const std::vector<std::string>& dcmKeys() const; 00640 virtual int bufferSize() const = 0; 00641 }; 00642 00646 class ALROBOTMODEL_API AngleActuator: public Actuator 00647 { 00648 public: 00650 AngleActuator(class AngleActuatorImpl* impl); 00652 AngleActuator(const AngleActuator& other); 00654 ~AngleActuator(); 00657 const AngleActuator* reflectedSymmetric() const; 00660 bool reflectedSymmetricReversed() const; 00662 bool reflectionForced() const; 00665 virtual int bufferSize() const; 00667 float startValue() const; 00669 float minValue() const; 00671 float maxValue() const; 00674 float maxSpeed() const; 00676 const Joint* controlledJoint() const; 00677 }; 00678 00682 class ALROBOTMODEL_API CoupledActuator: public Actuator 00683 { 00684 public: 00686 CoupledActuator(class CoupledActuatorImpl* impl); 00688 CoupledActuator(const CoupledActuator& other); 00690 ~CoupledActuator(); 00693 const CoupledActuator* reflectedSymmetric() const; 00696 bool reflectedSymmetricReversed() const; 00698 bool reflectionForced() const; 00701 virtual int bufferSize() const; 00704 float startValue() const; 00707 float minValue() const; 00710 float maxValue() const; 00712 float maxSpeed() const; 00715 std::vector<std::pair<const Joint*, float> > 00716 controlledJointAndRatios() const; 00717 }; 00718 00722 class ALROBOTMODEL_API TorqueActuator: public Actuator 00723 { 00724 public: 00726 TorqueActuator(class TorqueActuatorImpl* impl); 00728 TorqueActuator(const TorqueActuator& other); 00730 ~TorqueActuator(); 00733 const TorqueActuator* reflectedSymmetric() const; 00736 bool reflectedSymmetricReversed() const; 00739 virtual int bufferSize() const; 00742 float startValue() const; 00745 float minValue() const; 00748 float maxValue() const; 00750 const Joint* controlledJoint() const; 00751 }; 00752 00756 class ALROBOTMODEL_API AngleSpeedActuator: public Actuator 00757 { 00758 public: 00760 AngleSpeedActuator(class AngleSpeedActuatorImpl* impl); 00762 AngleSpeedActuator(const AngleSpeedActuator& other); 00764 ~AngleSpeedActuator(); 00767 const AngleSpeedActuator* reflectedSymmetric() const; 00770 bool reflectedSymmetricReversed() const; 00773 virtual int bufferSize() const; 00776 float startValue() const; 00779 float minValue() const; 00782 float maxValue() const; 00784 const Joint* controlledJoint() const; 00785 }; 00786 00790 class ALROBOTMODEL_API WheelTorqueActuator: public Actuator 00791 { 00792 public: 00794 WheelTorqueActuator(class WheelTorqueActuatorImpl* impl); 00796 WheelTorqueActuator(const WheelTorqueActuator& other); 00798 ~WheelTorqueActuator(); 00799 virtual int bufferSize() const; 00801 // Newton per meter). 00802 float maxTorque() const; 00804 const Joint* controlledJoint() const; 00805 }; 00806 00810 class ALROBOTMODEL_API WheelVelocityActuator: public Actuator 00811 { 00812 public: 00814 WheelVelocityActuator(class WheelVelocityActuatorImpl* impl); 00816 WheelVelocityActuator(const WheelVelocityActuator& other); 00818 ~WheelVelocityActuator(); 00821 virtual int bufferSize() const; 00824 float maxVelocity() const; 00826 const Joint* controlledJoint() const; 00827 }; 00828 00831 class ALROBOTMODEL_API LEDActuator: public DCMActuator 00832 { 00833 public: 00835 enum Color 00836 { 00837 RED, 00838 GREEN, 00839 BLUE 00840 }; 00841 00842 public: 00844 LEDActuator(class LEDActuatorImpl* impl); 00846 LEDActuator(const LEDActuator& other); 00848 ~LEDActuator(); 00851 virtual int bufferSize() const; 00853 const std::string& shortname() const; 00855 const std::vector<std::string>& groups() const; 00857 Color color() const; 00858 }; 00859 00863 class ALROBOTMODEL_API Sensor 00864 { 00865 public: 00867 enum Type 00868 { 00869 ANGLE, 00870 COUPLED, 00871 SONAR, 00872 CAMERA, 00873 FSR, 00874 INERTIAL, 00875 BUMPER, 00876 TORQUE, 00877 ANGLE_SPEED, 00878 WHEEL_VELOCITY, 00879 TACTILE, 00880 DEPTH_INFRARED, // deprecated 00881 SINGLE_DEPTH, 00882 ARRAY_DEPTH, 00883 CAMERA_DEPTH, 00884 MICROPHONE, 00890 }; 00894 Sensor(); 00896 ~Sensor(); 00898 const Frame* frame() const; 00900 virtual const std::string& name() const; 00902 Type type() const; 00905 virtual int bufferSize() const = 0; 00907 class SensorImpl* a_impl; 00908 }; 00909 00913 class ALROBOTMODEL_API DCMSensor: public Sensor 00914 { 00915 public: 00919 DCMSensor(); 00921 ~DCMSensor(); 00924 const std::vector<std::string>& dcmKeys() const; 00927 std::vector<std::string> fullDcmKeys() const; 00930 const std::vector<std::string>& dcmStateKeys() const; 00934 const std::vector<std::string>& dcmCommandKeys() const; 00937 virtual int bufferSize() const = 0; 00938 }; 00939 00940 00944 class ALROBOTMODEL_API AngleSensor: public DCMSensor 00945 { 00946 public: 00950 AngleSensor(); 00952 ~AngleSensor(); 00955 virtual int bufferSize() const; 00956 }; 00957 00960 class ALROBOTMODEL_API CoupledSensor: public DCMSensor 00961 { 00962 public: 00966 CoupledSensor(); 00968 ~CoupledSensor(); 00971 virtual int bufferSize() const; 00972 }; 00973 00977 class ALROBOTMODEL_API TorqueSensor: public DCMSensor 00978 { 00979 public: 00983 TorqueSensor(); 00985 ~TorqueSensor(); 00988 virtual int bufferSize() const; 00989 }; 00990 00995 class ALROBOTMODEL_API AngleSpeedSensor: public DCMSensor 00996 { 00997 public: 01001 AngleSpeedSensor(); 01003 ~AngleSpeedSensor(); 01006 virtual int bufferSize() const; 01007 }; 01008 01013 class ALROBOTMODEL_API WheelVelocitySensor: public DCMSensor 01014 { 01015 public: 01019 WheelVelocitySensor(); 01021 ~WheelVelocitySensor(); 01024 virtual int bufferSize() const; 01025 }; 01026 01029 class ALROBOTMODEL_API BaseCamera: public Sensor 01030 { 01031 public: 01035 BaseCamera(); 01037 ~BaseCamera(); 01040 virtual int bufferSize() const = 0; 01041 }; 01042 01045 class ALROBOTMODEL_API CameraSensor: public BaseCamera 01046 { 01047 public: 01051 CameraSensor(); 01053 ~CameraSensor(); 01056 virtual int bufferSize() const; 01058 int width() const; 01060 int height() const; 01061 }; 01062 01065 class ALROBOTMODEL_API CameraDepthSensor: public BaseCamera 01066 { 01067 public: 01071 CameraDepthSensor(); 01073 ~CameraDepthSensor(); 01076 virtual int bufferSize() const; 01078 int width() const; 01080 int height() const; 01081 }; 01082 01085 class ALROBOTMODEL_API FSRSensor: public DCMSensor 01086 { 01087 public: 01091 FSRSensor(); 01093 ~FSRSensor(); 01096 virtual int bufferSize() const; 01097 }; 01098 01101 class ALROBOTMODEL_API InertialSensor: public DCMSensor 01102 { 01103 public: 01107 InertialSensor(); 01109 ~InertialSensor(); 01112 virtual int bufferSize() const; 01113 }; 01114 01117 class ALROBOTMODEL_API SonarSensor: public DCMSensor 01118 { 01119 public: 01123 SonarSensor(); 01125 ~SonarSensor(); 01128 virtual int bufferSize() const; 01129 }; 01130 01133 class ALROBOTMODEL_API BumperSensor: public DCMSensor 01134 { 01135 public: 01139 BumperSensor(); 01141 ~BumperSensor(); 01144 virtual int bufferSize() const; 01145 }; 01146 01149 class ALROBOTMODEL_API TactileSensor: public DCMSensor 01150 { 01151 public: 01155 TactileSensor(); 01157 ~TactileSensor(); 01160 virtual int bufferSize() const; 01161 }; 01162 01166 class ALROBOTMODEL_API SingleDepthSensor: public DCMSensor 01167 { 01168 public: 01172 SingleDepthSensor(); 01174 ~SingleDepthSensor(); 01177 virtual int bufferSize() const; 01178 }; 01179 01183 class ALROBOTMODEL_API ArrayDepthSensor: public DCMSensor 01184 { 01185 public: 01189 ArrayDepthSensor(); 01191 ~ArrayDepthSensor(); 01194 virtual int bufferSize() const; 01196 int width() const; 01198 int height() const; 01199 }; 01200 01203 class ALROBOTMODEL_API MicrophoneSensor: public Sensor 01204 { 01205 public: 01209 MicrophoneSensor(); 01211 ~MicrophoneSensor(); 01214 virtual int bufferSize() const; 01215 }; 01216 01217 } 01218 01219 #endif // ALROBOTMODEL_H