Skip to content

Commit 194a7e3

Browse files
committed
added get methods to sensor_tof_matrix
1 parent 923ac33 commit 194a7e3

File tree

2 files changed

+64
-32
lines changed

2 files changed

+64
-32
lines changed

src/Arduino_Robot_Firmware.h

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class Arduino_Robot_Firmware{
110110

111111

112112
// BMS, MAX17332
113-
int beginBMS();
113+
int beginBMS();
114114
void updateBMS();
115115
float getBatteryVoltage();
116116
float getBatteryChargePercentage();
@@ -123,25 +123,25 @@ class Arduino_Robot_Firmware{
123123
float getRpmLeft();
124124
bool setRpmRight(const float rpm);
125125
float getRpmRight();
126-
bool setRpm(const float left, const float right);
127-
void getRpm(float & left, float & right);
128-
void setKPidRight(const float kp, const float ki, const float kd);
129-
void setKPidLeft(const float kp, const float ki, const float kd);
126+
bool setRpm(const float left, const float right); // sets RPMs on left and right wheels
127+
void getRpm(float & left, float & right); // get RPMs on left and right wheels
128+
void setKPidRight(const float kp, const float ki, const float kd); // set PID parameters for right wheel
129+
void setKPidLeft(const float kp, const float ki, const float kd); // set PID parameters for left wheel
130130

131131

132132
// Touch
133-
int beginTouch();
134-
void updateTouch();
135-
bool getAnyTouchPressed();
136-
bool getTouchKey(const uint8_t key);
137-
uint8_t getTouchKeys();
138-
bool getTouchUp();
139-
bool getTouchRight();
140-
bool getTouchDown();
141-
bool getTouchLeft();
142-
bool getTouchEnter();
143-
bool getTouchOk();
144-
bool getTouchDelete();
133+
int beginTouch(); // initialize touch
134+
void updateTouch(); // update touch status
135+
bool getAnyTouchPressed(); // get any touch pressed
136+
bool getTouchKey(const uint8_t key); // return true if key touch is pressed
137+
uint8_t getTouchKeys(); // return touched pads as byte
138+
bool getTouchUp(); // get nav pad up
139+
bool getTouchRight(); // get nav pad right
140+
bool getTouchDown(); // get nav pad down
141+
bool getTouchLeft(); // get nav pad left
142+
bool getTouchEnter(); // get nav pad enter (center circle)
143+
bool getTouchOk(); // get nav pad ok (right check)
144+
bool getTouchDelete(); // get nav pad delete (right x)
145145

146146

147147
// Leds
@@ -163,19 +163,19 @@ class Arduino_Robot_Firmware{
163163

164164

165165
// Imu
166-
int beginImu();
167-
void updateImu();
168-
float getAccelerationX();
169-
float getAccelerationY();
170-
float getAccelerationZ();
171-
float getAngularVelocityX();
172-
float getAngularVelocityY();
173-
float getAngularVelocityZ();
174-
float getRoll();
175-
float getPitch();
176-
float getYaw();
177-
178-
void errorLed(const int error_code);
166+
int beginImu(); // initialize LSD6DSOX-
167+
void updateImu(); // update accelerometer and gyroscope data. Update sensor fusion
168+
float getAccelerationX(); // get acceleration on x axis
169+
float getAccelerationY(); // get acceleration on y axis
170+
float getAccelerationZ(); // get acceleration on z axis
171+
float getAngularVelocityX(); // get angular velocity on x axis
172+
float getAngularVelocityY(); // get angular velocity on y axis
173+
float getAngularVelocityZ(); // get angular velocity on z axis
174+
float getRoll(); // get robot roll
175+
float getPitch(); // get robot pitch
176+
float getYaw(); // get robot yaw
177+
178+
void errorLed(const int error_code); // error routine, locks on code blinking led
179179

180180

181181

src/sensor_tof_matrix.h

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@ class SensorTofMatrix{
1919
int _ranging_freq;
2020
bool _wire_boost;
2121
uint32_t _wire_base_clock;
22-
23-
public:
22+
2423
int top;
2524
int bottom;
2625
int left;
2726
int right;
2827
int center_left;
2928
int center_right;
3029
int center;
30+
31+
public:
32+
3133

3234
SensorTofMatrix(TwoWire * wire, const uint8_t lpn_pin, const uint8_t i2c_rst_pin, const int size=4, const int ranging_freq=-1, const bool wire_boost = true, const uint32_t wire_base_clock=WIRE_BASE_CLOCK){
3335
_wire=wire;
@@ -69,6 +71,7 @@ class SensorTofMatrix{
6971
return out;
7072
}
7173

74+
/*
7275
void print(){
7376
VL53L7CX_ResultsData Results;
7477
uint8_t NewDataReady = 0;
@@ -89,6 +92,7 @@ class SensorTofMatrix{
8992
Serial.println();
9093
}
9194
}
95+
*/
9296

9397
bool update() {
9498
uint8_t NewDataReady = 0;
@@ -327,6 +331,34 @@ class SensorTofMatrix{
327331
return _avg/n;
328332
}
329333

334+
335+
int getTop(){
336+
return top;
337+
}
338+
339+
int getLeft(){
340+
return left;
341+
}
342+
343+
int getCenterLeft(){
344+
return center_left;
345+
}
346+
347+
int getCenter(){
348+
return center;
349+
}
350+
351+
int getCenterRight(){
352+
return center_right;
353+
}
354+
355+
int getRight(){
356+
return right;
357+
}
358+
359+
int getBottom(){
360+
return bottom;
361+
}
330362
};
331363

332364
#endif

0 commit comments

Comments
 (0)