Instrument Neutral Distributed Interface INDI 2.2.5
Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
INDI::IMU Class Reference

#include <indiimu.h>

Inheritance diagram for INDI::IMU:
INDI::DefaultDevice INDI::IMUInterface INDI::ParentDevice INDI::BaseDevice

Public Types

enum  { CONNECTION_NONE = 1 << 0 , CONNECTION_SERIAL = 1 << 1 , CONNECTION_I2C = 1 << 2 }
 
- Public Types inherited from INDI::ParentDevice
enum  Type { Valid , Invalid }
 
- Public Types inherited from INDI::BaseDevice
enum  INDI_ERROR { INDI_DEVICE_NOT_FOUND = -1 , INDI_PROPERTY_INVALID = -2 , INDI_PROPERTY_DUPLICATED = -3 , INDI_DISPATCH_ERROR = -4 }
 
enum  { INDI_ENABLED , INDI_DISABLED }
 
enum  WATCH { WATCH_NEW = 0 , WATCH_UPDATE , WATCH_NEW_OR_UPDATE }
 
enum  DRIVER_INTERFACE {
  GENERAL_INTERFACE = 0 , TELESCOPE_INTERFACE = (1 << 0) , CCD_INTERFACE = (1 << 1) , GUIDER_INTERFACE = (1 << 2) ,
  FOCUSER_INTERFACE = (1 << 3) , FILTER_INTERFACE = (1 << 4) , DOME_INTERFACE = (1 << 5) , GPS_INTERFACE = (1 << 6) ,
  WEATHER_INTERFACE = (1 << 7) , AO_INTERFACE = (1 << 8) , DUSTCAP_INTERFACE = (1 << 9) , LIGHTBOX_INTERFACE = (1 << 10) ,
  DETECTOR_INTERFACE = (1 << 11) , ROTATOR_INTERFACE = (1 << 12) , SPECTROGRAPH_INTERFACE = (1 << 13) , CORRELATOR_INTERFACE = (1 << 14) ,
  AUX_INTERFACE = (1 << 15) , OUTPUT_INTERFACE = (1 << 16) , INPUT_INTERFACE = (1 << 17) , POWER_INTERFACE = (1 << 18) ,
  IMU_INTERFACE = (1 << 19) , PAC_INTERFACE = (1 << 20) , SENSOR_INTERFACE = SPECTROGRAPH_INTERFACE | DETECTOR_INTERFACE | CORRELATOR_INTERFACE
}
 The DRIVER_INTERFACE enum defines the class of devices the driver implements. A driver may implement one or more interfaces. More...
 
typedef INDI::Properties Properties
 
- Public Types inherited from INDI::IMUInterface
enum  IMUCapability {
  IMU_HAS_ORIENTATION = 1 << 0 , IMU_HAS_ACCELERATION = 1 << 1 , IMU_HAS_GYROSCOPE = 1 << 2 , IMU_HAS_MAGNETOMETER = 1 << 3 ,
  IMU_HAS_CALIBRATION = 1 << 4 , IMU_HAS_TEMPERATURE = 1 << 5 , IMU_HAS_STABILITY_MON = 1 << 6 , IMU_HAS_SENSOR_FUSION = 1 << 7
}
 
enum  OrientationProperty {
  ORIENTATION_ROLL = 0 , ORIENTATION_PITCH , ORIENTATION_YAW , ORIENTATION_QUATERNION_W ,
  ORIENTATION_PROPERTY_COUNT
}
 
enum  AccelerationProperty { ACCELERATION_X = 0 , ACCELERATION_Y , ACCELERATION_Z , ACCELERATION_PROPERTY_COUNT }
 
enum  GyroscopeProperty { GYROSCOPE_X = 0 , GYROSCOPE_Y , GYROSCOPE_Z , GYROSCOPE_PROPERTY_COUNT }
 
enum  MagnetometerProperty { MAGNETOMETER_X = 0 , MAGNETOMETER_Y , MAGNETOMETER_Z , MAGNETOMETER_PROPERTY_COUNT }
 
enum  CalibrationStatusProperty {
  CALIBRATION_STATUS_SYS = 0 , CALIBRATION_STATUS_GYRO , CALIBRATION_STATUS_ACCEL , CALIBRATION_STATUS_MAG ,
  CALIBRATION_STATUS_PROPERTY_COUNT
}
 
enum  CalibrationControlProperty {
  CALIBRATION_CONTROL_START = 0 , CALIBRATION_CONTROL_SAVE , CALIBRATION_CONTROL_LOAD , CALIBRATION_CONTROL_RESET ,
  CALIBRATION_CONTROL_PROPERTY_COUNT
}
 
enum  PowerModeProperty { POWER_MODE_NORMAL = 0 , POWER_MODE_LOW_POWER , POWER_MODE_SUSPEND , POWER_MODE_PROPERTY_COUNT }
 
enum  OperationModeProperty {
  OPERATION_MODE_IMU = 0 , OPERATION_MODE_COMPASS , OPERATION_MODE_M4G , OPERATION_MODE_NDOF ,
  OPERATION_MODE_PROPERTY_COUNT
}
 
enum  DistanceUnitsProperty { DISTANCE_UNITS_METRIC = 0 , DISTANCE_UNITS_IMPERIAL , DISTANCE_UNITS_PROPERTY_COUNT }
 
enum  AngularUnitsProperty { ANGULAR_UNITS_DEGREES = 0 , ANGULAR_UNITS_RADIANS , ANGULAR_UNITS_PROPERTY_COUNT }
 
enum  UpdateRateProperty { UPDATE_RATE_RATE = 0 , UPDATE_RATE_PROPERTY_COUNT }
 
enum  OffsetsProperty { OFFSETS_X = 0 , OFFSETS_Y , OFFSETS_Z , OFFSETS_PROPERTY_COUNT }
 
enum  DeviceInfoProperty { DEVICE_INFO_CHIP_ID = 0 , DEVICE_INFO_FIRMWARE_VERSION , DEVICE_INFO_SENSOR_STATUS , DEVICE_INFO_PROPERTY_COUNT }
 
enum  TemperatureProperty { TEMPERATURE_VALUE = 0 , TEMPERATURE_PROPERTY_COUNT }
 
enum  StabilityMonitoringProperty { STABILITY_MONITORING_VIBRATION_LEVEL = 0 , STABILITY_MONITORING_STABILITY_THRESHOLD , STABILITY_MONITORING_PROPERTY_COUNT }
 

Public Member Functions

 IMU ()
 
virtual ~IMU ()
 
void setSupportedConnections (const uint8_t &value)
 
uint8_t getSupportedConnections () const
 Get the currently configured supported connection modes.
 
virtual const char * getDefaultName () override
 
virtual bool initProperties () override
 Initialize properties initial state and value. The child class must implement this function.
 
virtual bool updateProperties () override
 updateProperties is called whenever there is a change in the CONNECTION status of the driver. This will enable the driver to react to changes of switching ON/OFF a device. For example, a driver may only define a set of properties after a device is connected, but not before.
 
virtual bool Handshake ()
 Performs a device-specific handshake after a connection is established. This method should be overridden by concrete IMU drivers to implement any necessary communication checks or initialization sequences with the hardware. The base implementation does nothing and returns false.
 
- Public Member Functions inherited from INDI::DefaultDevice
 DefaultDevice ()
 
virtual ~DefaultDevice () override=default
 
void addAuxControls ()
 Add Debug, Simulation, and Configuration options to the driver.
 
void addDebugControl ()
 Add Debug control to the driver.
 
void addSimulationControl ()
 Add Simulation control to the driver.
 
void addConfigurationControl ()
 Add Configuration control to the driver.
 
void addPollPeriodControl ()
 Add Polling period control to the driver.
 
void addNicknameControl ()
 Add Nickname text property to the driver.
 
void resetProperties ()
 Set all properties to IDLE state.
 
void defineNumber (INumberVectorProperty *nvp)
 Define number vector to client & register it. Alternatively, IDDefNumber can be used but the property will not get registered and the driver will not be able to save configuration files.
 
void defineProperty (INumberVectorProperty *property)
 
void defineText (ITextVectorProperty *tvp)
 Define text vector to client & register it. Alternatively, IDDefText can be used but the property will not get registered and the driver will not be able to save configuration files.
 
void defineProperty (ITextVectorProperty *property)
 
void defineSwitch (ISwitchVectorProperty *svp)
 Define switch vector to client & register it. Alternatively, IDDefswitch can be used but the property will not get registered and the driver will not be able to save configuration files.
 
void defineProperty (ISwitchVectorProperty *property)
 
void defineLight (ILightVectorProperty *lvp)
 Define light vector to client & register it. Alternatively, IDDeflight can be used but the property will not get registered and the driver will not be able to save configuration files.
 
void defineProperty (ILightVectorProperty *property)
 
void defineBLOB (IBLOBVectorProperty *bvp)
 Define BLOB vector to client & register it. Alternatively, IDDefBLOB can be used but the property will not get registered and the driver will not be able to save configuration files.
 
void defineProperty (IBLOBVectorProperty *property)
 
void defineProperty (INDI::Property &property)
 
virtual bool deleteProperty (const char *propertyName)
 Delete a property and unregister it. It will also be deleted from all clients.
 
bool deleteProperty (INDI::Property &property)
 deleteProperty Delete a property and unregister it. It will also be deleted from all clients.
 
virtual void setConnected (bool status, IPState state=IPS_OK, const char *msg=nullptr)
 Set connection switch status in the client.
 
int SetTimer (uint32_t ms)
 Set a timer to call the function TimerHit after ms milliseconds.
 
void RemoveTimer (int id)
 Remove timer added with SetTimer.
 
virtual void TimerHit ()
 Callback function to be called once SetTimer duration elapses.
 
virtual const char * getDriverExec ()
 
virtual const char * getDriverName ()
 
void setVersion (uint16_t vMajor, uint16_t vMinor)
 Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
 
uint16_t getMajorVersion () const
 
uint16_t getMinorVersion () const
 
virtual void ISGetProperties (const char *dev)
 define the driver's properties to the client. Usually, only a minimum set of properties are defined to the client in this function if the device is in disconnected state. Those properties should be enough to enable the client to establish a connection to the device. In addition to CONNECT/DISCONNECT, such properties may include port name, IP address, etc. You should check if the device is already connected, and if this is true, then you must define the remainder of the the properties to the client in this function. Otherwise, the remainder of the driver's properties are defined to the client in updateProperties() function which is called when a client connects/disconnects from a device.
 
virtual bool ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
 Process the client newBLOB command.
 
virtual bool ISSnoopDevice (XMLEle *root)
 Process a snoop event from INDI server. This function is called when a snooped property is updated in a snooped driver.
 
bool ISNewProperty (INDI::Property &property, const std::string &elementName, const std::any &value)
 Generic convenience function to update a property element as if by client request, simulating an ISNew... call.
 
template<typename PropertyType , typename ValueType >
bool updateProperty (PropertyType &property, ValueType *values, char *names[], int n, std::function< bool()> updater, bool saveConfig=false)
 Generic helper function to update an INDI property based on an external operation.
 
uint32_t getDriverInterface () const
 
void setDriverInterface (uint32_t value)
 setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE. You may send an ORed list of DeviceInterface values.
 
void watchDevice (const char *deviceName, const std::function< void(INDI::BaseDevice)> &callback)
 Add a device to the watch list.
 
- Public Member Functions inherited from INDI::ParentDevice
 ParentDevice (Type type)
 
 ~ParentDevice ()
 
 ParentDevice (ParentDevice &&other)=default
 
ParentDevice & operator= (ParentDevice &&other)=default
 
- Public Member Functions inherited from INDI::BaseDevice
 BaseDevice ()
 
virtual ~BaseDevice ()
 
void registerProperty (const INDI::Property &property)
 Register the property to be able to observe and update.
 
void registerProperty (const INDI::Property &property, INDI_PROPERTY_TYPE type)
 
int removeProperty (const char *name, char *errmsg)
 Remove a property.
 
void watchProperty (const char *name, const std::function< void(INDI::Property)> &callback, WATCH watch=WATCH_NEW)
 Call the callback function if property is available.
 
Property getProperty (const char *name, INDI_PROPERTY_TYPE type=INDI_UNKNOWN) const
 Return a property and its type given its name.
 
Properties getProperties ()
 Return a list of all properties in the device.
 
const Properties getProperties () const
 
INDI::PropertyNumber getNumber (const char *name) const
 
INDI::PropertyText getText (const char *name) const
 
INDI::PropertySwitch getSwitch (const char *name) const
 
INDI::PropertyLight getLight (const char *name) const
 
INDI::PropertyBlob getBLOB (const char *name) const
 
IPState getPropertyState (const char *name) const
 
IPerm getPropertyPermission (const char *name) const
 
void * getRawProperty (const char *name, INDI_PROPERTY_TYPE type=INDI_UNKNOWN) const
 Return a property and its type given its name.
 
void addMessage (const std::string &msg)
 Add message to the driver's message queue.
 
void checkMessage (XMLEle *root)
 
void doMessage (XMLEle *msg)
 
const std::string & messageQueue (size_t index) const
 
const std::string & lastMessage () const
 
bool isValid () const
 
bool isSameDevice (const BaseDevice &other) const
 
bool isConnected () const
 
void attach ()
 indicates that the device is ready
 
void detach ()
 indicates that the device is being removed
 
void setMediator (INDI::BaseMediator *mediator)
 Set the driver's mediator to receive notification of news devices and updated property values.
 
INDI::BaseMediator * getMediator () const
 
void setDeviceName (const char *dev)
 Set the device name.
 
const char * getDeviceName () const
 
bool isDeviceNameMatch (const char *otherName) const
 Check that the device name matches the argument.
 
bool isDeviceNameMatch (const std::string &otherName) const
 Check that the device name matches the argument.
 
const char * getDriverName () const
 
const char * getDriverExec () const
 
const char * getDriverVersion () const
 
uint16_t getDriverInterface () const
 getDriverInterface returns ORed values of DRIVER_INTERFACE. It presents the device classes supported by the driver.
 
bool buildSkeleton (const char *filename)
 Build driver properties from a skeleton file.
 
int buildProp (const INDI::LilXmlElement &root, char *errmsg, bool isDynamic=false)
 Build a property given the supplied XML element (defXXX)
 
int setValue (const INDI::LilXmlElement &root, char *errmsg)
 handle SetXXX commands from client
 
 operator BaseDevice * ()
 
BaseDevice * operator-> ()
 
bool operator!= (std::nullptr_t) const
 
bool operator== (std::nullptr_t) const
 
 operator bool () const
 
 operator bool ()
 
- Public Member Functions inherited from INDI::IMUInterface
uint32_t GetCapability () const
 GetIMUCapability returns the capability of the IMU device.
 
void SetCapability (uint32_t cap)
 SetIMUCapability sets the IMU capabilities. All capabilities must be initialized.
 
bool HasOrientation ()
 
bool HasAcceleration ()
 
bool HasGyroscope ()
 
bool HasMagnetometer ()
 
bool HasCalibration ()
 
bool HasTemperature ()
 
bool HasStabilityMonitoring ()
 

Public Attributes

enum INDI::IMU:: { ... }  IMUConnection
 

Protected Types

enum  { AXIS1_OFFSET = 0 , AXIS2_OFFSET , ROTATION_OFFSET }
 
enum  { AXIS1 = 0 , AXIS2 }
 
enum  { COORD_EQUATORIAL = 0 , COORD_ALTAZ }
 
enum  IMUFrame { ENU = 0 , NWU , SWU }
 
enum  Location { LOCATION_LATITUDE , LOCATION_LONGITUDE , LOCATION_ELEVATION }
 
enum  OrientationAdjustments {
  ROLL_MULTIPLIER = 0 , PITCH_MULTIPLIER , YAW_MULTIPLIER , ROLL_OFFSET ,
  PITCH_OFFSET , YAW_OFFSET
}
 
enum  TelescopeVector { TELESCOPE_VECTOR_X = 0 , TELESCOPE_VECTOR_Y , TELESCOPE_VECTOR_Z }
 
enum  SensorFusionSwitch { FUSION_ENABLE = 0 , FUSION_DISABLE = 1 }
 
enum  FusionTypeSwitch { FUSION_MADGWICK = 0 , FUSION_MAHONY = 1 }
 
enum  FusionParam { FUSION_PARAM_1 = 0 , FUSION_PARAM_2 = 1 }
 

Protected Member Functions

void QuaternionToEuler (double i, double j, double k, double w, double &roll, double &pitch, double &yaw)
 
void EulerToQuaternion (double roll, double pitch, double yaw, double &i, double &j, double &k, double &w)
 
virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n) override
 Process the client newNumber command.
 
virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) override
 Process the client newSwitch command.
 
virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n) override
 Process the client newSwitch command.
 
virtual bool saveConfigItems (FILE *fp) override
 saveConfigItems Save specific properties in the provide config file handler. Child class usually override this function to save their own properties and the base class saveConfigItems(fp) must be explicitly called by each child class. The Default Device saveConfigItems(fp) only save Debug properties options in the config file.
 
bool SetOrientationData (double roll, double pitch, double yaw, double w=0.0) override
 SetOrientationData Set the orientation data (Roll, Pitch, Yaw, Quaternion W)
 
bool SetAccelerationData (double x, double y, double z) override
 SetAccelerationData Set the linear acceleration data.
 
bool SetGyroscopeData (double x, double y, double z) override
 SetGyroscopeData Set the angular velocity data.
 
bool SetMagnetometerData (double x, double y, double z) override
 SetMagnetometerData Set the magnetic field strength data.
 
virtual bool StartCalibration () override
 StartCalibration Initiate the calibration sequence.
 
virtual bool SaveCalibrationData () override
 SaveCalibrationData Save the current calibration data.
 
virtual bool LoadCalibrationData () override
 LoadCalibrationData Load previously saved calibration data.
 
virtual bool ResetCalibration () override
 ResetCalibration Reset calibration data.
 
virtual bool SetPowerMode (const std::string &mode) override
 SetPowerMode Set the power mode of the IMU sensor.
 
virtual bool SetOperationMode (const std::string &mode) override
 SetOperationMode Set the operation mode of the IMU sensor.
 
virtual bool SetDistanceUnits (bool metric) override
 SetUnits Set the units for sensor data.
 
virtual bool SetAngularUnits (bool degrees) override
 SetAngularUnits Set the angular units for sensor data.
 
virtual bool SetUpdateRate (double rate) override
 SetUpdateRate Set the sensor polling frequency.
 
void RecalculateAstroCoordinates ()
 
- Protected Member Functions inherited from INDI::DefaultDevice
void setDynamicPropertiesBehavior (bool defineEnabled, bool deleteEnabled)
 setDynamicPropertiesBehavior controls handling of dynamic properties. Dynamic properties are those generated from an external skeleton XML file. By default all properties, including dynamic properties, are defined to the client in ISGetProperties(). Furthermore, when űdeleteProperty(properyName) is called, the dynamic property is deleted by default, and can only be restored by calling buildSkeleton(filename) again. However, it is sometimes desirable to skip the definition of the dynamic properties on startup and delegate this task to the child class. To control this behavior, set enabled to false.
 
virtual bool loadConfig (bool silent=false, const char *property=nullptr)
 Load the last saved configuration file.
 
bool loadConfig (INDI::Property &property)
 Load property config from the configuration file. If the property configuration is successfully parsed, the corresponding ISNewXXX is called with the values parsed from the config file.
 
virtual bool saveConfig (bool silent=false, const char *property=nullptr)
 Save the current properties in a configuration file.
 
bool saveConfig (INDI::Property &property)
 Save a property in the configuration file.
 
virtual bool purgeConfig ()
 purgeConfig Remove config file from disk.
 
virtual bool saveAllConfigItems (FILE *fp)
 saveAllConfigItems Save all the drivers' properties in the configuration file
 
virtual bool loadDefaultConfig ()
 Load the default configuration file.
 
void setDebug (bool enable)
 Toggle driver debug status A driver can be more verbose if Debug option is enabled by the client.
 
void setSimulation (bool enable)
 Toggle driver simulation status A driver can run in simulation mode if Simulation option is enabled by the client.
 
virtual void debugTriggered (bool enable)
 Inform driver that the debug option was triggered. This function is called after setDebug is triggered by the client. Reimplement this function if your driver needs to take specific action after debug is enabled/disabled. Otherwise, you can use isDebug() to check if simulation is enabled or disabled.
 
virtual void simulationTriggered (bool enable)
 Inform driver that the simulation option was triggered. This function is called after setSimulation is triggered by the client. Reimplement this function if your driver needs to take specific action after simulation is enabled/disabled. Otherwise, you can use isSimulation() to check if simulation is enabled or disabled.
 
bool isDebug () const
 
bool isSimulation () const
 
virtual bool Connect ()
 Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interface (Serial or TCP) governed by connectionMode. If connection is successful, it proceed to call Handshake() function to ensure communication with device is successful. For other communication interface, override the method in the child class implementation.
 
virtual bool Disconnect ()
 Disconnect from device.
 
void registerConnection (Connection::Interface *newConnection)
 registerConnection Add new connection plugin to the existing connection pool. The connection type shall be defined to the client in ISGetProperties()
 
bool unRegisterConnection (Connection::Interface *existingConnection)
 unRegisterConnection Remove connection from existing pool
 
Connection::Interface * getActiveConnection ()
 
void setActiveConnection (Connection::Interface *existingConnection)
 setActiveConnection Switch the active connection to the passed connection plugin
 
void setDefaultPollingPeriod (uint32_t msec)
 setDefaultPollingPeriod Change the default polling period to call TimerHit() function in the driver.
 
void setPollingPeriodRange (uint32_t minimum, uint32_t maximum)
 setPollingPeriodRange Set the range permitted by the polling range in milliseconds
 
uint32_t getPollingPeriod () const
 getPollingPeriod Return the polling period.
 
void setCurrentPollingPeriod (uint32_t msec)
 setCurrentPollingPeriod Change the current polling period to call TimerHit() function in the driver.
 
uint32_t getCurrentPollingPeriod () const
 getCurrentPollingPeriod Return the current polling period.
 
uint32_t & refCurrentPollingPeriod () __attribute__((deprecated))
 
uint32_t refCurrentPollingPeriod () const __attribute__((deprecated))
 
bool isConfigLoading () const
 isConfigLoading Check if driver configuration is currently in the process of getting loaded.
 
bool isInitializationComplete () const
 isInitializationComplete Check if driver initialization is complete.
 
void syncDriverInfo ()
 syncDriverInfo sends the current driver information to the client.
 
void setDeviceNickname (const char *nick)
 Set the device nickname.
 
const char * getDeviceNickname ()
 
const char * lookupDeviceNicknameFromId (const char *identifier, const char *device=nullptr)
 Lookup device nickname for an identifier.
 
bool setDeviceNicknameFromId (const char *identifier)
 Set device nickname based on an identifier.
 
void saveNicknameId (const char *nickname, const char *identifier)
 
virtual void nicknameSet (const char *nickname)
 Inform driver that the nickname has been set.
 
 DefaultDevice (const std::shared_ptr< DefaultDevicePrivate > &dd)
 
- Protected Member Functions inherited from INDI::ParentDevice
 ParentDevice (const std::shared_ptr< ParentDevicePrivate > &dd)
 
- Protected Member Functions inherited from INDI::BaseDevice
 BaseDevice (BaseDevicePrivate &dd)
 
 BaseDevice (const std::shared_ptr< BaseDevicePrivate > &dd)
 
- Protected Member Functions inherited from INDI::IMUInterface
 IMUInterface (DefaultDevice *defaultDevice)
 
virtual ~IMUInterface ()=default
 
void initProperties (const std::string &groupName)
 Initialize IMU properties. It is recommended to call this function within initProperties() of your primary device.
 
bool updateProperties ()
 updateProperties Define or Delete IMU properties based on the connection status of the base device
 
bool processNumber (const std::string &dev, const std::string &name, double values[], char *names[], int n)
 Process IMU number properties.
 
bool processSwitch (const std::string &dev, const std::string &name, ISState *states, char *names[], int n)
 Process IMU switch properties.
 
bool processText (const std::string &dev, const std::string &name, char *texts[], char *names[], int n)
 Process IMU text properties.
 
bool saveConfigItems (FILE *fp)
 saveConfigItems Save IMU properties in config file
 
virtual bool SetCalibrationStatus (int sys, int gyro, int accel, int mag)
 SetCalibrationStatus Set the calibration status for each sensor.
 
virtual bool SetDeviceInfo (const std::string &chipID, const std::string &firmwareVersion, const std::string &sensorStatus)
 SetDeviceInfo Set chip ID, firmware version, and sensor status.
 
virtual bool SetTemperature (double temperature)
 SetTemperature Set the internal chip temperature.
 
virtual bool SetStabilityMonitoring (double vibrationLevel, double stabilityThreshold)
 SetStabilityMonitoring Set vibration level and alert threshold.
 

Protected Attributes

INDI::PropertyNumber AstroCoordinatesNP {2}
 
INDI::PropertySwitch AstroCoordsTypeSP {2}
 
INDI::PropertySwitch IMUFrameSP {3}
 
INDI::PropertyNumber OrientationAdjustmentsNP {6}
 
INDI::PropertyNumber SyncAxisNP {2}
 
INDI::PropertyNumber TelescopeVectorNP {3}
 
INDI::PropertyNumber GeographicCoordNP {3}
 
INDI::PropertyNumber MagneticDeclinationNP {1}
 
INDI::PropertySwitch SensorFusionSP {2}
 Enable / Disable software sensor fusion.
 
INDI::PropertySwitch FusionTypeSP {2}
 Select fusion algorithm: Madgwick or Mahony.
 
INDI::PropertyNumber FusionParamsNP {2}
 Algorithm tuning parameters (β for Madgwick; Kp & Ki for Mahony)
 
Connection::Serial * serialConnection = nullptr
 
Connection::I2C * i2cConnection = nullptr
 
int PortFD = -1
 
- Protected Attributes inherited from INDI::BaseDevice
std::shared_ptr< BaseDevicePrivate > d_ptr
 
- Protected Attributes inherited from INDI::IMUInterface
INDI::PropertyNumber OrientationNP {ORIENTATION_PROPERTY_COUNT}
 
INDI::PropertyNumber AccelerationNP {ACCELERATION_PROPERTY_COUNT}
 
INDI::PropertyNumber GyroscopeNP {GYROSCOPE_PROPERTY_COUNT}
 
INDI::PropertyNumber MagnetometerNP {MAGNETOMETER_PROPERTY_COUNT}
 
INDI::PropertyLight CalibrationStatusLP {CALIBRATION_STATUS_PROPERTY_COUNT}
 
INDI::PropertySwitch CalibrationControlSP {CALIBRATION_CONTROL_PROPERTY_COUNT}
 
INDI::PropertySwitch PowerModeSP {POWER_MODE_PROPERTY_COUNT}
 
INDI::PropertySwitch OperationModeSP {OPERATION_MODE_PROPERTY_COUNT}
 
INDI::PropertySwitch DistanceUnitsSP {DISTANCE_UNITS_PROPERTY_COUNT}
 
INDI::PropertySwitch AngularUnitsSP {ANGULAR_UNITS_PROPERTY_COUNT}
 
INDI::PropertyNumber UpdateRateNP {UPDATE_RATE_PROPERTY_COUNT}
 
INDI::PropertyNumber DataThresholdNP {1}
 
INDI::PropertyText DeviceInfoTP {DEVICE_INFO_PROPERTY_COUNT}
 
INDI::PropertyNumber TemperatureNP {TEMPERATURE_PROPERTY_COUNT}
 
INDI::PropertyNumber StabilityMonitoringNP {STABILITY_MONITORING_PROPERTY_COUNT}
 
const std::string IMU_TAB {"IMU"}
 
const std::string CALIBRATION_TAB {"Calibration"}
 
const std::string STATUS_TAB {"Status"}
 
const std::string COORDINATES_TAB {"Coordinates"}
 

Additional Inherited Members

- Static Public Member Functions inherited from INDI::BaseDevice
static std::string getSharedFilePath (std::string fileName)
 

Detailed Description

Definition at line 39 of file indiimu.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
CONNECTION_NONE 
CONNECTION_SERIAL 

Do not use any connection plugin

CONNECTION_I2C 

For regular serial and bluetooth connections

Definition at line 48 of file indiimu.h.

◆ anonymous enum

anonymous enum
protected
Enumerator
AXIS1_OFFSET 
AXIS2_OFFSET 
ROTATION_OFFSET 

Definition at line 119 of file indiimu.h.

◆ anonymous enum

anonymous enum
protected
Enumerator
AXIS1 
AXIS2 

Definition at line 126 of file indiimu.h.

◆ anonymous enum

anonymous enum
protected
Enumerator
COORD_EQUATORIAL 
COORD_ALTAZ 

Definition at line 132 of file indiimu.h.

◆ FusionParam

enum INDI::IMU::FusionParam
protected
Enumerator
FUSION_PARAM_1 

β for Madgwick; Kp for Mahony

FUSION_PARAM_2 

unused for Madgwick; Ki for Mahony

Definition at line 204 of file indiimu.h.

◆ FusionTypeSwitch

Enumerator
FUSION_MADGWICK 
FUSION_MAHONY 

Definition at line 198 of file indiimu.h.

◆ IMUFrame

enum INDI::IMU::IMUFrame
protected
Enumerator
ENU 
NWU 
SWU 

Definition at line 138 of file indiimu.h.

◆ Location

enum INDI::IMU::Location
protected
Enumerator
LOCATION_LATITUDE 
LOCATION_LONGITUDE 
LOCATION_ELEVATION 

Definition at line 145 of file indiimu.h.

◆ OrientationAdjustments

Enumerator
ROLL_MULTIPLIER 
PITCH_MULTIPLIER 
YAW_MULTIPLIER 
ROLL_OFFSET 
PITCH_OFFSET 
YAW_OFFSET 

Definition at line 157 of file indiimu.h.

◆ SensorFusionSwitch

Enumerator
FUSION_ENABLE 
FUSION_DISABLE 

Definition at line 192 of file indiimu.h.

◆ TelescopeVector

Enumerator
TELESCOPE_VECTOR_X 
TELESCOPE_VECTOR_Y 
TELESCOPE_VECTOR_Z 

Definition at line 172 of file indiimu.h.

Constructor & Destructor Documentation

◆ IMU()

INDI::IMU::IMU ( )

Definition at line 33 of file indiimu.cpp.

◆ ~IMU()

INDI::IMU::~IMU ( )
virtual

Definition at line 41 of file indiimu.cpp.

Member Function Documentation

◆ EulerToQuaternion()

void INDI::IMU::EulerToQuaternion ( double  roll,
double  pitch,
double  yaw,
double &  i,
double &  j,
double &  k,
double &  w 
)
protected

Definition at line 653 of file indiimu.cpp.

◆ getDefaultName()

virtual const char * INDI::IMU::getDefaultName ( )
inlineoverridevirtual
Returns
Default name of the device.

Implements INDI::DefaultDevice.

Definition at line 71 of file indiimu.h.

◆ getSupportedConnections()

uint8_t INDI::IMU::getSupportedConnections ( ) const
inline

Get the currently configured supported connection modes.

Returns
A bitmask (ORed combination) of IMUConnection enum values.

Definition at line 66 of file indiimu.h.

◆ Handshake()

bool INDI::IMU::Handshake ( )
virtual

Performs a device-specific handshake after a connection is established. This method should be overridden by concrete IMU drivers to implement any necessary communication checks or initialization sequences with the hardware. The base implementation does nothing and returns false.

Returns
true if the handshake is successful, false otherwise.

Definition at line 610 of file indiimu.cpp.

◆ initProperties()

bool INDI::IMU::initProperties ( )
overridevirtual

Initialize properties initial state and value. The child class must implement this function.

Returns
True if initialization is successful, false otherwise.

Reimplemented from INDI::DefaultDevice.

Definition at line 60 of file indiimu.cpp.

◆ ISNewNumber()

bool INDI::IMU::ISNewNumber ( const char *  dev,
const char *  name,
double  values[],
char *  names[],
int  n 
)
overrideprotectedvirtual

Process the client newNumber command.

Note
This function is called by the INDI framework, do not call it directly.
Returns
True if any property was successfully processed, false otherwise.

Reimplemented from INDI::DefaultDevice.

Definition at line 241 of file indiimu.cpp.

◆ ISNewSwitch()

bool INDI::IMU::ISNewSwitch ( const char *  dev,
const char *  name,
ISState *  states,
char *  names[],
int  n 
)
overrideprotectedvirtual

Process the client newSwitch command.

Note
This function is called by the INDI framework, do not call it directly.
Returns
True if any property was successfully processed, false otherwise.

Reimplemented from INDI::DefaultDevice.

Definition at line 518 of file indiimu.cpp.

◆ ISNewText()

bool INDI::IMU::ISNewText ( const char *  dev,
const char *  name,
char *  texts[],
char *  names[],
int  n 
)
overrideprotectedvirtual

Process the client newSwitch command.

Note
This function is called by the INDI framework, do not call it directly.
Returns
True if any property was successfully processed, false otherwise.

Reimplemented from INDI::DefaultDevice.

Definition at line 579 of file indiimu.cpp.

◆ LoadCalibrationData()

bool INDI::IMU::LoadCalibrationData ( )
overrideprotectedvirtual

LoadCalibrationData Load previously saved calibration data.

Returns
True if successful, false otherwise

Reimplemented from INDI::IMUInterface.

Definition at line 1336 of file indiimu.cpp.

◆ QuaternionToEuler()

void INDI::IMU::QuaternionToEuler ( double  i,
double  j,
double  k,
double  w,
double &  roll,
double &  pitch,
double &  yaw 
)
protected

Definition at line 632 of file indiimu.cpp.

◆ RecalculateAstroCoordinates()

void INDI::IMU::RecalculateAstroCoordinates ( )
protected

Definition at line 668 of file indiimu.cpp.

◆ ResetCalibration()

bool INDI::IMU::ResetCalibration ( )
overrideprotectedvirtual

ResetCalibration Reset calibration data.

Returns
True if successful, false otherwise

Reimplemented from INDI::IMUInterface.

Definition at line 1340 of file indiimu.cpp.

◆ SaveCalibrationData()

bool INDI::IMU::SaveCalibrationData ( )
overrideprotectedvirtual

SaveCalibrationData Save the current calibration data.

Returns
True if successful, false otherwise

Reimplemented from INDI::IMUInterface.

Definition at line 1332 of file indiimu.cpp.

◆ saveConfigItems()

bool INDI::IMU::saveConfigItems ( FILE *  fp)
overrideprotectedvirtual

saveConfigItems Save specific properties in the provide config file handler. Child class usually override this function to save their own properties and the base class saveConfigItems(fp) must be explicitly called by each child class. The Default Device saveConfigItems(fp) only save Debug properties options in the config file.

Parameters
fpPointer to config file handler
Returns
True if successful, false otherwise.

Reimplemented from INDI::DefaultDevice.

Definition at line 587 of file indiimu.cpp.

◆ SetAccelerationData()

bool INDI::IMU::SetAccelerationData ( double  x,
double  y,
double  z 
)
overrideprotectedvirtual

SetAccelerationData Set the linear acceleration data.

Parameters
xX-axis acceleration in m/s²
yY-axis acceleration in m/s²
zZ-axis acceleration in m/s²
Returns
True if successful, false otherwise

Reimplemented from INDI::IMUInterface.

Definition at line 1207 of file indiimu.cpp.

◆ SetAngularUnits()

bool INDI::IMU::SetAngularUnits ( bool  degrees)
overrideprotectedvirtual

SetAngularUnits Set the angular units for sensor data.

Parameters
degreesTrue for degrees, false for radians
Returns
True if successful, false otherwise

Reimplemented from INDI::IMUInterface.

Definition at line 1359 of file indiimu.cpp.

◆ SetDistanceUnits()

bool INDI::IMU::SetDistanceUnits ( bool  metric)
overrideprotectedvirtual

SetUnits Set the units for sensor data.

Parameters
metricTrue for metric, false for imperial
Returns
True if successful, false otherwise

Reimplemented from INDI::IMUInterface.

Definition at line 1354 of file indiimu.cpp.

◆ SetGyroscopeData()

bool INDI::IMU::SetGyroscopeData ( double  x,
double  y,
double  z 
)
overrideprotectedvirtual

SetGyroscopeData Set the angular velocity data.

Parameters
xX-axis angular velocity in rad/s or deg/s
yY-axis angular velocity in rad/s or deg/s
zZ-axis angular velocity in rad/s or deg/s
Returns
True if successful, false otherwise

Reimplemented from INDI::IMUInterface.

Definition at line 1220 of file indiimu.cpp.

◆ SetMagnetometerData()

bool INDI::IMU::SetMagnetometerData ( double  x,
double  y,
double  z 
)
overrideprotectedvirtual

SetMagnetometerData Set the magnetic field strength data.

Parameters
xX-axis magnetic field strength in µT
yY-axis magnetic field strength in µT
zZ-axis magnetic field strength in µT
Returns
True if successful, false otherwise

Reimplemented from INDI::IMUInterface.

Definition at line 1282 of file indiimu.cpp.

◆ SetOperationMode()

bool INDI::IMU::SetOperationMode ( const std::string &  mode)
overrideprotectedvirtual

SetOperationMode Set the operation mode of the IMU sensor.

Parameters
modeOperation mode (e.g., IMU, Compass, NDOF)
Returns
True if successful, false otherwise

Reimplemented from INDI::IMUInterface.

Definition at line 1349 of file indiimu.cpp.

◆ SetOrientationData()

bool INDI::IMU::SetOrientationData ( double  roll,
double  pitch,
double  yaw,
double  w = 0.0 
)
overrideprotectedvirtual

SetOrientationData Set the orientation data (Roll, Pitch, Yaw, Quaternion W)

Parameters
rollRoll angle in degrees
pitchPitch angle in degrees
yawYaw/Azimuth angle in degrees
wQuaternion W component (optional)
Returns
True if successful, false otherwise

Reimplemented from INDI::IMUInterface.

Definition at line 1025 of file indiimu.cpp.

◆ SetPowerMode()

bool INDI::IMU::SetPowerMode ( const std::string &  mode)
overrideprotectedvirtual

SetPowerMode Set the power mode of the IMU sensor.

Parameters
modePower mode (e.g., Normal, Low Power, Suspend)
Returns
True if successful, false otherwise

Reimplemented from INDI::IMUInterface.

Definition at line 1344 of file indiimu.cpp.

◆ setSupportedConnections()

void INDI::IMU::setSupportedConnections ( const uint8_t &  value)
@brief setConnection Set IMU connection mode. Child class should call this in the constructor before IMU registers
any connection interfaces
Parameters
valueA bitmask (ORed combination) of IMUConnection enum values (e.g., CONNECTION_SERIAL | CONNECTION_I2C).

Definition at line 47 of file indiimu.cpp.

◆ SetUpdateRate()

bool INDI::IMU::SetUpdateRate ( double  rate)
overrideprotectedvirtual

SetUpdateRate Set the sensor polling frequency.

Parameters
rateFrequency in Hz
Returns
True if successful, false otherwise

Reimplemented from INDI::IMUInterface.

Definition at line 1364 of file indiimu.cpp.

◆ StartCalibration()

bool INDI::IMU::StartCalibration ( )
overrideprotectedvirtual

StartCalibration Initiate the calibration sequence.

Returns
True if successful, false otherwise

Reimplemented from INDI::IMUInterface.

Definition at line 1328 of file indiimu.cpp.

◆ updateProperties()

bool INDI::IMU::updateProperties ( )
overridevirtual

updateProperties is called whenever there is a change in the CONNECTION status of the driver. This will enable the driver to react to changes of switching ON/OFF a device. For example, a driver may only define a set of properties after a device is connected, but not before.

Returns
True if update is successful, false otherwise.

Reimplemented from INDI::DefaultDevice.

Definition at line 187 of file indiimu.cpp.

Member Data Documentation

◆ AstroCoordinatesNP

INDI::PropertyNumber INDI::IMU::AstroCoordinatesNP {2}
protected

Definition at line 152 of file indiimu.h.

◆ AstroCoordsTypeSP

INDI::PropertySwitch INDI::IMU::AstroCoordsTypeSP {2}
protected

Definition at line 153 of file indiimu.h.

◆ FusionParamsNP

INDI::PropertyNumber INDI::IMU::FusionParamsNP {2}
protected

Algorithm tuning parameters (β for Madgwick; Kp & Ki for Mahony)

Definition at line 215 of file indiimu.h.

◆ FusionTypeSP

INDI::PropertySwitch INDI::IMU::FusionTypeSP {2}
protected

Select fusion algorithm: Madgwick or Mahony.

Definition at line 213 of file indiimu.h.

◆ GeographicCoordNP

INDI::PropertyNumber INDI::IMU::GeographicCoordNP {3}
protected

Definition at line 181 of file indiimu.h.

◆ i2cConnection

Connection::I2C* INDI::IMU::i2cConnection = nullptr
protected

Definition at line 218 of file indiimu.h.

◆ []

enum { ... } INDI::IMU::IMUConnection

◆ IMUFrameSP

INDI::PropertySwitch INDI::IMU::IMUFrameSP {3}
protected

Definition at line 154 of file indiimu.h.

◆ MagneticDeclinationNP

INDI::PropertyNumber INDI::IMU::MagneticDeclinationNP {1}
protected

Definition at line 183 of file indiimu.h.

◆ OrientationAdjustmentsNP

INDI::PropertyNumber INDI::IMU::OrientationAdjustmentsNP {6}
protected

Definition at line 166 of file indiimu.h.

◆ PortFD

int INDI::IMU::PortFD = -1
protected

Definition at line 220 of file indiimu.h.

◆ SensorFusionSP

INDI::PropertySwitch INDI::IMU::SensorFusionSP {2}
protected

Enable / Disable software sensor fusion.

Definition at line 211 of file indiimu.h.

◆ serialConnection

Connection::Serial* INDI::IMU::serialConnection = nullptr
protected

Definition at line 217 of file indiimu.h.

◆ SyncAxisNP

INDI::PropertyNumber INDI::IMU::SyncAxisNP {2}
protected

Definition at line 169 of file indiimu.h.

◆ TelescopeVectorNP

INDI::PropertyNumber INDI::IMU::TelescopeVectorNP {3}
protected

Definition at line 178 of file indiimu.h.


The documentation for this class was generated from the following files: