ArPiRobot-CoreLib C++
C++ library for ArPiRobot robots
OldAdafruit9Dof.hpp
1 /*
2  * Copyright 2021 Marcus Behel
3  *
4  * This file is part of ArPiRobot-CoreLib.
5  *
6  * ArPiRobot-CoreLib is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * ArPiRobot-CoreLib is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with ArPiRobot-CoreLib. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #pragma once
21 
22 #include <arpirobot/arduino/device/ArduinoDevice.hpp>
23 #include <arpirobot/arduino/iface/BaseArduinoInterface.hpp>
24 
25 namespace arpirobot{
33  public:
34 
39  OldAdafruit9Dof(bool createDevice = true, int deviceId = -1);
40 
48  void calibrate(uint16_t samples);
49 
54  double getGyroX();
55 
60  double getGyroY();
61 
66  double getGyroZ();
67 
72  double getAccelX();
73 
78  double getAccelY();
79 
84  double getAccelZ();
85 
90  void setGyroX(double newGyroX);
91 
96  void setGyroY(double newGyroY);
97 
102  void setGyroZ(double newGyroZ);
103 
104  protected:
105  void applyDefaultState() override;
106  std::vector<uint8_t> getCreateData() override;
107  void handleData(const std::vector<uint8_t> &data) override;
108 
109  private:
110  double gyroX = 0, gyroY = 0, gyroZ = 0, accelX = 0, accelY = 0, accelZ = 0;
111  double gyroXOffset = 0, gyroYOffset = 0, gyroZOffset = 0;
112  };
113 
114 }
Definition: ArduinoDevice.hpp:35
Definition: OldAdafruit9Dof.hpp:32
void calibrate(uint16_t samples)
void setGyroX(double newGyroX)
OldAdafruit9Dof(bool createDevice=true, int deviceId=-1)
void setGyroY(double newGyroY)
void setGyroZ(double newGyroZ)
Definition: ArduinoDevice.hpp:27