INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
hydrosegwayrmpacfr/unitconverter.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef SEGWAYRMP_UNITCONVERTER_H 00012 #define SEGWAYRMP_UNITCONVERTER_H 00013 00014 #include "rmpdefs.h" 00015 #include <stdint.h> 00016 00017 namespace segwayrmpacfr { 00018 00019 // 00020 // @brief convert between S.I. units and RMP native units (counts) 00021 // 00022 // @author Alex Brooks 00023 // 00024 class UnitConverter 00025 { 00026 00027 public: 00028 00029 explicit UnitConverter( RmpModel model ); 00030 00031 // counts -> S.I. units 00032 // (some angles are specified in revs) 00033 double angleInRadiansFromRevCounts( int counts ) const; 00034 // (others are specified in degrees) 00035 double angleInRadians( int counts ) const; 00036 double angularRateInRadians( int counts ) const; 00037 double distanceInM( int counts ) const; 00038 double speedInMperS( int counts ) const; 00039 double torqueInNM( int counts ) const; 00040 double uiVoltageInVolts( int counts ) const; 00041 double baseVoltageInVolts( int counts ) const; 00042 OperationalMode operationalModeAsEnum( int i ) const; 00043 GainSchedule gainScheduleAsEnum( int i ) const; 00044 00045 // S.I. units -> raw RMP values 00046 int speedCommandAsRaw( double si ) const; 00047 int angularRateCommandAsRaw( double si ) const; 00048 uint16_t configurationCommandAsRaw( ConfigurationCommand cmd ) const; 00049 uint16_t maxVelocityScaleFactorAsRaw( double scale ) const; 00050 uint16_t maxTurnrateScaleFactorAsRaw( double scale ) const; 00051 uint16_t maxAccelerationScaleFactorAsRaw( double scale ) const; 00052 uint16_t maxCurrentLimitScaleFactorAsRaw( double scale ) const; 00053 00054 private: 00055 00056 double countsPerM() const; 00057 double countsPerMperS() const; 00058 double countsPerRevolution() const; 00059 double countsPerNM() const; 00060 00061 RmpModel model_; 00062 00063 }; 00064 00065 } 00066 00067 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)