simulator-sdk  1.14.5
alrobotmodel/alrobotmodel/alrobotmodel.h
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 AngleActuator;
00027   class AngleSensor;
00028   class AngleSpeedActuator;
00029   class AngleSpeedSensor;
00030   class BumperSensor;
00031   class CameraSensor;
00032   class CoupledActuator;
00033   class CoupledSensor;
00034   class DepthInfraredSensor;
00035   class FSRSensor;
00036   class InertialSensor;
00037   class SonarSensor;
00038   class TactileSensor;
00039   class DepthInfraredSensor;
00040   class LEDActuator;
00041   class Joint;
00042   class Link;
00043   class Sensor;
00044   class TorqueActuator;
00045   class TorqueSensor;
00046   class WheelTorqueActuator;
00047   class WheelVelocityActuator;
00048   class WheelVelocitySensor;
00049 
00052 class ALROBOTMODEL_API Model
00053 {
00054   public:
00055 
00060     Model(const std::string& pathToModel);
00062     ~Model();
00063 
00065     const std::string& name() const;
00066 
00067 
00070     const std::string& configFile() const;
00071 
00072 
00075     std::vector<const Joint*> joints() const;
00078     const Joint* joint(const std::string& jointName) const;
00079 
00082     std::vector<const Link*> links() const;
00085     const Link* link(const std::string& linkName) const;
00089     const Link* rootLink() const;
00090 
00093     std::vector<const Actuator*> actuators() const;
00096     const Actuator* actuator(const std::string& actuatorName) const;
00097 
00100     std::vector<const AngleActuator*> angleActuators() const;
00103     const AngleActuator* angleActuator(const std::string& actuatorName) const;
00104 
00107     std::vector<const CoupledActuator*> coupledActuators() const;
00110     const CoupledActuator* coupledActuator(
00111       const std::string& actuatorName) const;
00112 
00115     std::vector<const TorqueActuator*> torqueActuators() const;
00118     const TorqueActuator* torqueActuator(
00119       const std::string& actuatorName) const;
00120 
00123     std::vector<const AngleSpeedActuator*> angleSpeedActuators() const;
00126     const AngleSpeedActuator* angleSpeedActuator(
00127       const std::string& actuatorName) const;
00128 
00131     std::vector<const WheelTorqueActuator*> wheelTorqueActuators() const;
00134     const WheelTorqueActuator* wheelTorqueActuator(
00135       const std::string& actuatorName) const;
00136 
00139     std::vector<const WheelVelocityActuator*> wheelVelocityActuators() const;
00142     const WheelVelocityActuator* wheelVelocityActuator(
00143       const std::string& actuatorName) const;
00144 
00147     std::vector<const LEDActuator*> ledActuators() const;
00150     const LEDActuator* ledActuator(const std::string& actuatorName) const;
00151 
00154     std::vector<const Sensor*> sensors() const;
00157     const Sensor* sensor(const std::string& sensorName) const;
00158 
00161     std::vector<const AngleSensor*> angleSensors() const;
00164     const AngleSensor* angleSensor(const std::string& sensorName) const;
00165 
00168     std::vector<const CoupledSensor*> coupledSensors() const;
00171     const CoupledSensor* coupledSensor(const std::string& sensorName) const;
00172 
00175     std::vector<const TorqueSensor*> torqueSensors() const;
00178     const TorqueSensor* torqueSensor(const std::string& sensorName) const;
00179 
00182     std::vector<const AngleSpeedSensor*> angleSpeedSensors() const;
00185     const AngleSpeedSensor* angleSpeedSensor(
00186       const std::string& sensorName) const;
00187 
00190     std::vector<const WheelVelocitySensor*> wheelVelocitySensors() const;
00193     const WheelVelocitySensor* wheelVelocitySensor(
00194       const std::string& sensorName) const;
00195 
00198     std::vector<const CameraSensor*> cameraSensors() const;
00201     const CameraSensor* cameraSensor(const std::string& sensorName) const;
00202 
00205     std::vector<const FSRSensor*> fsrSensors() const;
00208     const FSRSensor* fsrSensor(const std::string& sensorName) const;
00209 
00212     std::vector<const InertialSensor*> inertialSensors() const;
00215     const InertialSensor* inertialSensor(const std::string& sensorName) const;
00216 
00219     std::vector<const SonarSensor*> sonarSensors() const;
00222     const SonarSensor* sonarSensor(const std::string& sensorName) const;
00223 
00226     std::vector<const BumperSensor*> bumperSensors() const;
00229     const BumperSensor* bumperSensor(const std::string& sensorName) const;
00230 
00233     std::vector<const TactileSensor*> tactileSensors() const;
00236     const TactileSensor* tactileSensor(const std::string& sensorName) const;
00237 
00240     std::vector<const DepthInfraredSensor*> depthInfraredSensors() const;
00243     const DepthInfraredSensor* depthInfraredSensor(
00244       const std::string& sensorName) const;
00245 
00247     class ModelImpl* a_impl;
00248 };
00249 
00252 class ALROBOTMODEL_API Frame
00253 {
00254   public:
00257     Frame();
00259     ~Frame();
00261     const std::string& name() const;
00266     const AL::Math::Transform& position() const;
00268     const Frame* parentFrame() const;
00272     const AL::Math::Transform& localPosition() const;
00277     static AL::Math::Transform globalPosition(
00278       const Frame* frame);
00280     class FrameImpl* a_impl;
00281 };
00282 
00285 class ALROBOTMODEL_API Joint
00286 {
00287   public:
00290     Joint();
00292     ~Joint();
00296     const Frame* frame() const;
00298     const std::string& name() const;
00303     const Link* parentLink() const;
00308     const Link* childLink() const;
00310     class JointImpl* a_impl;
00311 };
00312 
00316 ALROBOTMODEL_API bool frictionCoeff(
00317   const std::string& frictionMaterial1,
00318   const std::string& frictionMaterial2,
00319   float& frictionCoeff);
00320 
00324 class ALROBOTMODEL_API MassData
00325 {
00326   public:
00330     MassData();
00332     virtual ~MassData();
00334     float mass() const;
00339     const AL::Math::Position3D& CoM() const;
00342     const std::vector<float>& inertiaMatrix() const;
00344     class MassDataImpl* a_impl;
00345 };
00346 
00350 class ALROBOTMODEL_API VisualData
00351 {
00352   public:
00356     VisualData();
00358     virtual ~VisualData();
00365     const std::string& meshPath() const;
00368     const AL::Math::Transform& meshTransform() const;
00370     class VisualDataImpl* a_impl;
00371 };
00372 
00375 class ALROBOTMODEL_API Link
00376 {
00377   public:
00378     enum LinkType
00379     {
00380       CLASSIC,
00381       WHEEL_OMNI,
00382     };
00385     Link();
00387     virtual ~Link();
00393     const Frame* frame() const;
00395     const std::string& name() const;
00398     const Joint* parentJoint() const;
00401     const std::vector<const Joint*> childrenJoints() const;
00403     const MassData* mass() const;
00405     const std::string& frictionMaterial() const;
00407     const VisualData* visual() const;
00409     LinkType type() const;
00411     class LinkImpl* a_impl;
00412 };
00413 
00417 class ALROBOTMODEL_API Actuator
00418 {
00419   public:
00421     enum Type
00422     {
00423       ANGLE_MOTOR,
00424       COUPLED_MOTOR,
00425       TORQUE_MOTOR,
00426       ANGLE_SPEED_MOTOR,
00427       WHEEL_TORQUE,
00428       WHEEL_VELOCITY,
00430       LED,
00431 
00432     };
00436     Actuator();
00438     ~Actuator();
00440     const Frame* frame() const;
00442     const virtual std::string& name() const;
00444     Type type() const;
00447     virtual int bufferSize() const = 0;
00449     class ActuatorImpl* a_impl;
00450 };
00451 
00455 class ALROBOTMODEL_API AngleActuator: public Actuator
00456 {
00457   public:
00461     AngleActuator();
00463     ~AngleActuator();
00466     const AngleActuator* reflectedSymmetric() const;
00469     bool reflectedSymmetricReversed() const;
00471     double proportionalGain() const;
00474     virtual int bufferSize() const;
00476     float startValue() const;
00478     float minValue() const;
00480     float maxValue() const;
00483     float maxSpeed() const;
00485     const Joint* controlledJoint() const;
00486 };
00487 
00491 class ALROBOTMODEL_API CoupledActuator: public Actuator
00492 {
00493   public:
00497     CoupledActuator();
00499     ~CoupledActuator();
00502     const CoupledActuator* reflectedSymmetric() const;
00505     bool reflectedSymmetricReversed() const;
00507     double proportionalGain() const;
00510     virtual int bufferSize() const;
00513     float startValue() const;
00516     float minValue() const;
00519     float maxValue() const;
00521     float maxSpeed() const;
00524     std::vector<std::pair<const Joint*, float> >
00525       controlledJointAndRatios() const;
00526 };
00527 
00531 class ALROBOTMODEL_API TorqueActuator: public Actuator
00532 {
00533   public:
00537     TorqueActuator();
00539     ~TorqueActuator();
00542     const TorqueActuator* reflectedSymmetric() const;
00545     bool reflectedSymmetricReversed() const;
00547     double proportionalGain() const;
00549     double derivativeGain() const;
00552     virtual int bufferSize() const;
00555     float startValue() const;
00558     float minValue() const;
00561     float maxValue() const;
00563     const Joint* controlledJoint() const;
00564 };
00565 
00569 class ALROBOTMODEL_API AngleSpeedActuator: public Actuator
00570 {
00571   public:
00575     AngleSpeedActuator();
00577     ~AngleSpeedActuator();
00580     const AngleSpeedActuator* reflectedSymmetric() const;
00583     bool reflectedSymmetricReversed() const;
00585     double derivativeGain() const;
00588     virtual int bufferSize() const;
00591     float startValue() const;
00594     float minValue() const;
00597     float maxValue() const;
00599     const Joint* controlledJoint() const;
00600 };
00601 
00605 class ALROBOTMODEL_API WheelTorqueActuator: public Actuator
00606 {
00607   public:
00611     WheelTorqueActuator();
00613     ~WheelTorqueActuator();
00615     double proportionalGain() const;
00617     double derivativeGain() const;
00620     virtual int bufferSize() const;
00622     // Newton per meter).
00623     float maxTorque() const;
00625     const Joint* controlledJoint() const;
00626 };
00627 
00631 class ALROBOTMODEL_API WheelVelocityActuator: public Actuator
00632 {
00633   public:
00637     WheelVelocityActuator();
00639     ~WheelVelocityActuator();
00641     double derivativeGain() const;
00644     virtual int bufferSize() const;
00646     // Newton per meter).
00647     float maxVelocity() const;
00649     const Joint* controlledJoint() const;
00650 };
00651 
00654 class ALROBOTMODEL_API LEDActuator: public Actuator
00655 {
00656   public:
00657     enum Color
00658     {
00659       RED,
00660       GREEN,
00661       BLUE
00662     };
00663 
00664   public:
00668     LEDActuator();
00670     ~LEDActuator();
00673     virtual int bufferSize() const;
00675     Color color() const;
00676 };
00677 
00681 class ALROBOTMODEL_API Sensor
00682 {
00683   public:
00685     enum Type
00686     {
00687       ANGLE,
00688       COUPLED,
00689       SONAR,
00690       CAMERA,
00691       FSR,
00692       INERTIAL,
00693       BUMPER,
00694       TORQUE,
00695       ANGLE_SPEED,
00696       WHEEL_VELOCITY,
00697       TACTILE,
00698       DEPTH_INFRARED,
00704     };
00708     Sensor();
00710     ~Sensor();
00712     const Frame* frame() const;
00714     virtual const std::string& name() const;
00716     Type type() const;
00719     virtual int bufferSize() const = 0;
00721     class SensorImpl* a_impl;
00722 };
00723 
00727 class ALROBOTMODEL_API DCMSensor: public Sensor
00728 {
00729   public:
00733     DCMSensor();
00735     ~DCMSensor();
00738     const std::vector<std::string>& dcmKeys() const;
00741     virtual int bufferSize() const = 0;
00742 };
00743 
00744 
00748 class ALROBOTMODEL_API AngleSensor: public DCMSensor
00749 {
00750   public:
00754     AngleSensor();
00756     ~AngleSensor();
00759     virtual int bufferSize() const;
00760 };
00761 
00764 class ALROBOTMODEL_API CoupledSensor: public DCMSensor
00765 {
00766   public:
00770     CoupledSensor();
00772     ~CoupledSensor();
00775     virtual int bufferSize() const;
00776 };
00777 
00781 class ALROBOTMODEL_API TorqueSensor: public DCMSensor
00782 {
00783   public:
00787     TorqueSensor();
00789     ~TorqueSensor();
00792     virtual int bufferSize() const;
00793 };
00794 
00799 class ALROBOTMODEL_API AngleSpeedSensor: public DCMSensor
00800 {
00801   public:
00805     AngleSpeedSensor();
00807     ~AngleSpeedSensor();
00810     virtual int bufferSize() const;
00811 };
00812 
00817 class ALROBOTMODEL_API WheelVelocitySensor: public DCMSensor
00818 {
00819   public:
00823     WheelVelocitySensor();
00825     ~WheelVelocitySensor();
00828     virtual int bufferSize() const;
00829 };
00830 
00833 class ALROBOTMODEL_API CameraSensor: public Sensor
00834 {
00835   public:
00839     CameraSensor();
00841     ~CameraSensor();
00844     virtual int bufferSize() const;
00846     int width() const;
00848     int height() const;
00849 };
00850 
00853 class ALROBOTMODEL_API FSRSensor: public DCMSensor
00854 {
00855   public:
00859     FSRSensor();
00861     ~FSRSensor();
00864     virtual int bufferSize() const;
00865 };
00866 
00869 class ALROBOTMODEL_API InertialSensor: public DCMSensor
00870 {
00871   public:
00875     InertialSensor();
00877     ~InertialSensor();
00880     virtual int bufferSize() const;
00881 };
00882 
00885 class ALROBOTMODEL_API SonarSensor: public DCMSensor
00886 {
00887   public:
00891     SonarSensor();
00893     ~SonarSensor();
00896     virtual int bufferSize() const;
00897 };
00898 
00901 class ALROBOTMODEL_API BumperSensor: public DCMSensor
00902 {
00903   public:
00907     BumperSensor();
00909     ~BumperSensor();
00912     virtual int bufferSize() const;
00913 };
00914 
00917 class ALROBOTMODEL_API TactileSensor: public DCMSensor
00918 {
00919   public:
00923     TactileSensor();
00925     ~TactileSensor();
00928     virtual int bufferSize() const;
00929 };
00930 
00933 class ALROBOTMODEL_API DepthInfraredSensor: public DCMSensor
00934 {
00935   public:
00939     DepthInfraredSensor();
00941     ~DepthInfraredSensor();
00944     virtual int bufferSize() const;
00945 };
00946 
00969 
00970 }
00971 
00972 #endif // ALROBOTMODEL_H
 All Classes Namespaces Functions Variables Enumerations Enumerator