Skip to content

Commit 8f41988

Browse files
Final revision
messeages to users about calibration keywords properties
1 parent c0322a4 commit 8f41988

File tree

8 files changed

+62
-44
lines changed

8 files changed

+62
-44
lines changed

RoboHeart.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ void RoboHeart::setAutomaticRotation(){
116116
calculateDiff();
117117
counter = 0;
118118
Serial.println("Calibration failed, trying again...");
119+
erial.println("Please let RoboHeart in stable position...");
119120
}
120121
}
121122
Serial.println("RoboHeart calibrated");
@@ -185,7 +186,7 @@ char* RoboHeart::handleMotorMessage(MotorMSGType motorMSG) {
185186

186187

187188
void RoboHeart::calculateDiff(int timeout_ms){
188-
Serial.println("Drift");
189+
//Serial.println("Drift");
189190
_driftX = 0;
190191
_driftY = 0;
191192
_driftZ = 0;
@@ -209,7 +210,7 @@ bool RoboHeart::isCalibrated(int timeout_ms) {
209210
}
210211
delay(1);
211212
}
212-
Serial.println(counter);
213+
//Serial.println(counter);
213214
return (counter < (timeout_ms / 3));
214215
}
215216

examples/RoboHeartBalanceBot/RoboHeartBalanceBot.ino

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Building a One-board balancing bot instructions can be found here:
1010
* https://www.instructables.com/A-One-board-Balancing-Bot-With-a-RoboHeart-Electro/
1111
*
12-
* Created 30/01/2022
12+
* Created 16/08/2024
1313
* By Augmented Robotics
1414
*
1515
* Check out https://roboheart.de/en_gb/ for more information about RoboHeart.
@@ -20,7 +20,9 @@
2020

2121
RoboHeart heart = RoboHeart(Serial);
2222

23-
// PID controller parameters
23+
// PID controller parameters.
24+
// You should change parameters based on your setup.
25+
// You can use our another example RoboHeartPIDFittingExample to try set parameters to stabilise.
2426
#define Kp 20
2527
#define Kd 0
2628
#define Ki 40
@@ -85,6 +87,8 @@ void setup() {
8587
// calibration
8688
heart.begin();
8789

90+
Serial.println("Please let RoboHeart in stable position...");
91+
8892
//Run IMU calibration and calculation of absolute rotation
8993
heart.setAutomaticRotation();
9094

examples/RoboHeartBalanceBotContol/RoboHeartBalanceBotContol.ino

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Building a One-board balancing bot instructions can be found here:
1313
* https://www.instructables.com/A-One-board-Balancing-Bot-With-a-RoboHeart-Electro/
1414
*
15-
* Created 30/01/2022
15+
* Created 16/08/2024
1616
* By Augmented Robotics
1717
*
1818
* Check out https://roboheart.de/en_gb/ for more information about RoboHeart.
@@ -24,7 +24,9 @@
2424

2525
RoboHeart heart = RoboHeart(Serial);
2626

27-
// PID controller parameters
27+
// PID controller parameters.
28+
// You should change parameters based on your setup.
29+
// You can use our another example RoboHeartPIDFittingExample to try set parameters to stabilise.
2830
#define Kp 20
2931
#define Kd 0
3032
#define Ki 40
@@ -208,7 +210,9 @@ void setup() {
208210
// Initialize RoboHeart with or without request for IMU automatic
209211
// calibration
210212
heart.begin();
211-
213+
214+
Serial.println("Please let RoboHeart in stable position...");
215+
212216
//Run IMU calibration and calculation of absolute rotation
213217
heart.setAutomaticRotation();
214218

examples/RoboHeartIMU/RoboHeartIMU.ino

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,28 @@ void loop() {
2727

2828
// print IMU data every second
2929
if (millis() - prevPrintTime > 1000) {
30-
Serial.print("\nAccelerometer [G]:\n");
31-
Serial.print(" X = ");
32-
Serial.println(heart.imu.readFloatAccelX(), 4);
33-
Serial.print(" Y = ");
34-
Serial.println(heart.imu.readFloatAccelY(), 4);
35-
Serial.print(" Z = ");
36-
Serial.println(heart.imu.readFloatAccelZ(), 4);
37-
38-
Serial.print("\nGyroscope [angular velocity]:\n");
39-
Serial.print(" X = ");
40-
Serial.println(heart.imu.readFloatGyroX(), 4);
41-
Serial.print(" Y = ");
42-
Serial.println(heart.imu.readFloatGyroY(), 4);
43-
Serial.print(" Z = ");
44-
Serial.println(heart.imu.readFloatGyroZ(), 4);
45-
46-
Serial.print("\nThermometer:\n");
47-
Serial.print(" Degrees C = ");
48-
Serial.println(heart.getTemperatureC(), 4);
49-
Serial.print(" Degrees F = ");
50-
Serial.println(heart.getTemperatureF(), 4);
51-
F("=====================================================\n");
52-
prevPrintTime = millis();
30+
Serial.print("\nAccelerometer [G]:\n");
31+
Serial.print(" X = ");
32+
Serial.println(heart.imu.readFloatAccelX(), 4);
33+
Serial.print(" Y = ");
34+
Serial.println(heart.imu.readFloatAccelY(), 4);
35+
Serial.print(" Z = ");
36+
Serial.println(heart.imu.readFloatAccelZ(), 4);
37+
38+
Serial.print("\nGyroscope [angular velocity]:\n");
39+
Serial.print(" X = ");
40+
Serial.println(heart.imu.readFloatGyroX(), 4);
41+
Serial.print(" Y = ");
42+
Serial.println(heart.imu.readFloatGyroY(), 4);
43+
Serial.print(" Z = ");
44+
Serial.println(heart.imu.readFloatGyroZ(), 4);
45+
46+
Serial.print("\nThermometer:\n");
47+
Serial.print(" Degrees C = ");
48+
Serial.println(heart.getTemperatureC(), 4);
49+
Serial.print(" Degrees F = ");
50+
Serial.println(heart.getTemperatureF(), 4);
51+
F("=====================================================\n");
52+
prevPrintTime = millis();
5353
}
5454
}

examples/RoboHeartRotation/RoboHeartRotation.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This example shows how to calculate rotation
2-
* from LSM6DS3 data.
2+
* from the built-in IMU data.
33
*
44
* Created 27/06/2024
55
* By Augmented Robotics
@@ -55,6 +55,7 @@ void setup() {
5555
calculateDrifts();
5656
int counter = 0;
5757
Serial.println("RoboHeart calibrating...");
58+
Serial.println("Please let it in stable position...");
5859
while (isCalibrated() == 0) {
5960
counter++;
6061
if(counter > 3){
Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
1+
/* This example shows how to set automatic rotation calculation
2+
* from the built-in IMU data.
3+
*
4+
* Created 27/06/2024
5+
* By Augmented Robotics
6+
*
7+
* Check out https://roboheart.de/en_gb/ for more information about RoboHeart.
8+
*/
9+
110
#include <RoboHeart.h>
211

312
RoboHeart heart = RoboHeart(Serial);
413

514
void setup()
615
{
716
Serial.begin(115200);
8-
Serial.println("Starting RoboHeart automatic rotation example..");
17+
Serial.println("Starting RoboHeart automatic rotation example...");
18+
Serial.println("Please let it in stable position...");
919
heart.begin();
1020
heart.setAutomaticRotation();
1121
}
1222

1323
void loop()
1424
{
15-
Serial.print("\nRotation:\n");
16-
Serial.print(" X = ");
17-
Serial.println(heart.getRotationX(), 4);
18-
Serial.print(" Y = ");
19-
Serial.println(heart.getRotationY(), 4);
20-
Serial.print(" Z = ");
21-
Serial.println(heart.getRotationZ(), 4);
22-
delay(2000);
25+
Serial.print("\nRotation:\n");
26+
Serial.print(" X = ");
27+
Serial.println(heart.getRotationX(), 4);
28+
Serial.print(" Y = ");
29+
Serial.println(heart.getRotationY(), 4);
30+
Serial.print(" Z = ");
31+
Serial.println(heart.getRotationZ(), 4);
32+
delay(2000);
2333
}

keywords.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,4 @@ RH_APP_SERVICE_UUID LITERAL1
7878
RH_APP_CHARACTERISTIC_UUID1 LITERAL1
7979
RH_APP_CHARACTERISTIC_UUID2 LITERAL1
8080
RH_APP_CHARACTERISTIC_UUID3 LITERAL1
81-
STEPPER_MOTOR_MAX_STEPS LITERAL1
82-
ROBOHEART_AP_SSID LITERAL1
83-
ROBOHEART_AP_PASSWORD LITERAL1
81+
STEPPER_MOTOR_MAX_STEPS LITERAL1

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ paragraph=The RoboHeart library is compatible with the RoboHeart hardware platfo
77
category=Communication
88
url=https://github.com/Augmented-Robotics/roboheart-arduino-library
99
architectures=*
10-
depends=TinyGSM,PubSubClient,Arduino_JSON,SparkFun LSM6DS3 Breakout, ESP Async WebServer
10+
depends=TinyGSM,PubSubClient,Arduino_JSON,SparkFun LSM6DS3 Breakout,ESP Async WebServer

0 commit comments

Comments
 (0)