Simplification de code et changement de valeurs
This commit is contained in:
parent
8dea440f6b
commit
2d7be3ade0
8
IO.hpp
8
IO.hpp
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
#define PIN_TIRETTE 5
|
#define PIN_TIRETTE 5
|
||||||
#define PIN_BUTTON_COLOR 6
|
#define PIN_BUTTON_COLOR 6
|
||||||
#define PIN_MOTOR1 2
|
#define PIN_MOTOR1 1
|
||||||
#define PIN_MOTOR2 1
|
#define PIN_MOTOR2 2
|
||||||
#define PIN_SERVO 7
|
#define PIN_SERVO 7
|
||||||
|
|
||||||
#define DANCING_ACTION_DELTA_ANGLE 2
|
#define DANCING_ACTION_DELTA_ANGLE 2
|
||||||
|
@ -15,6 +15,8 @@
|
||||||
#define GAIN_KD 100
|
#define GAIN_KD 100
|
||||||
#define ANGULAR_SPEED 10 // °/s
|
#define ANGULAR_SPEED 10 // °/s
|
||||||
|
|
||||||
|
using std::abs;
|
||||||
|
|
||||||
enum class Axes {
|
enum class Axes {
|
||||||
X,
|
X,
|
||||||
Y,
|
Y,
|
||||||
|
@ -120,7 +122,7 @@ class IO {
|
||||||
|
|
||||||
Serial.printf("Angular Speed : %d\nStatic Cast : %d\nprev_time : %d\n millis : %d\n", angular_speed, static_cast<float>(millis() / 1000 - prev_time / 1000), prev_time, millis());
|
Serial.printf("Angular Speed : %d\nStatic Cast : %d\nprev_time : %d\n millis : %d\n", angular_speed, static_cast<float>(millis() / 1000 - prev_time / 1000), prev_time, millis());
|
||||||
|
|
||||||
if(std::abs(err_dir) < angular_displacement)
|
if(abs(err_dir) < angular_displacement)
|
||||||
{
|
{
|
||||||
m_dir = dir;
|
m_dir = dir;
|
||||||
}
|
}
|
||||||
|
|
4
Main.ino
4
Main.ino
|
@ -76,8 +76,8 @@ void loop()
|
||||||
//Serial.printf("Is Selected Color Blue : %d\n", my_IO.isSelectedColorBlue());
|
//Serial.printf("Is Selected Color Blue : %d\n", my_IO.isSelectedColorBlue());
|
||||||
//Serial.printf("Is Tirette Pulled : %d\n", my_IO.isTirettePulled());
|
//Serial.printf("Is Tirette Pulled : %d\n", my_IO.isTirettePulled());
|
||||||
|
|
||||||
my_IO.setDirWithAngularSpeed(90);
|
my_IO.setDir(0);
|
||||||
my_IO.setSpeed(1024.0f);
|
my_IO.setSpeed(2048.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue