-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1704369
commit 3999ede
Showing
21 changed files
with
20,830 additions
and
420 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
plot 'data6.csv' using 0:1 with lines title 'X',\ | ||
'data6.csv' using 0:2 with lines title 'Y',\ | ||
'data6.csv' using 0:3 with lines title 'X point',\ | ||
'data6.csv' using 0:4 with lines title 'Y point',\ | ||
'data6.csv' using 0:5 with lines title 'M0',\ | ||
'data6.csv' using 0:7 with lines title 'M2',\ | ||
'data6.csv' using 0:(-3*$2) with lines title 'csigne X point' | ||
|
||
|
||
while (1) { # make a new 'gpio.dat' every cycle with fresh data | ||
replot | ||
pause 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#include "motormanager.hpp" | ||
|
||
MotorManager::MotorManager() | ||
{ | ||
for(int i = 0; i <= 3 ; i++) | ||
{ | ||
motor_value[i] = 0; | ||
} | ||
|
||
motor[0].attach(6);//23 | ||
motor[1].attach(7);//22 | ||
motor[2].attach(9);//20 | ||
motor[3].attach(8);//21 | ||
|
||
gain_x = 1; | ||
gain_y = 1; | ||
gain_z = 1; | ||
gain_h = 1; | ||
|
||
stop_motor = 1; | ||
|
||
} | ||
void MotorManager::setOn() | ||
{ | ||
stop_motor = 0; | ||
} | ||
|
||
|
||
void MotorManager::setOff() | ||
{ | ||
for(unsigned int i = 0 ; i < 4 ; i++) | ||
{ | ||
motor_value[i] = 0; | ||
motor[i].write(55); | ||
} | ||
|
||
stop_motor = 1; | ||
|
||
} | ||
|
||
void MotorManager::command(float command_x, float command_y, float command_z, float command_h) | ||
{ | ||
|
||
motor_value[0] = gain_y * ( 1 * command_y) + gain_x * (-1 * command_x) + (-1 * command_z) + gain_h * command_h; | ||
motor_value[1] = gain_y * ( 1 * command_y) + gain_x * ( 1 * command_x) + ( 1 * command_z) + gain_h * command_h; | ||
motor_value[2] = gain_y * (-1 * command_y) + gain_x * ( 1 * command_x) + (-1 * command_z) + gain_h * command_h; | ||
motor_value[3] = gain_y * (-1 * command_y) + gain_x * (-1 * command_x) + ( 1 * command_z) + gain_h * command_h; | ||
|
||
for(int i = 0; i < 4 ; i++) | ||
{ | ||
if(! stop_motor) | ||
{ | ||
motor[i].write(writeMicroseconds(1000 + motor_value[i]*1000); // moteurs calibrés pour être à zéro pour 1000 et au max à 2000 | ||
} | ||
else | ||
{ | ||
motor_value[i] = 0; | ||
motor[i].write(55); | ||
} | ||
} | ||
|
||
} | ||
|
||
void MotorManager::startMotors() //needed to "arm" the ESC, without that, they wont start. | ||
{ | ||
delay(100); | ||
for(int i = 0; i <= 3 ; i++) | ||
{ | ||
motor[i].write(10); | ||
} | ||
delay(100); | ||
for(int i = 0; i <= 3 ; i++) | ||
{ | ||
motor[i].write(55); | ||
} | ||
|
||
stop_motor = 0; | ||
} | ||
|
||
float MotorManager::getMotorValue(int motor_id) | ||
{ | ||
if(motor_id < 4 && motor_id >= 0) | ||
{ | ||
return motor_value[motor_id]; | ||
} | ||
|
||
return 0; | ||
} |
Oops, something went wrong.