Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 3 commits
  • 43 files changed
  • 0 commit comments
  • 1 contributor
Showing with 98 additions and 5 deletions.
  1. 0 arduino/{grosrobot → othersgrosrobot}/clientIRC/othersbot.py
  2. 0 arduino/{petitrobot → othersgrosrobot}/driver/AFMotor.cpp
  3. 0 arduino/{petitrobot → othersgrosrobot}/driver/AFMotor.h
  4. 0 arduino/{petitrobot → othersgrosrobot}/driver/HardwareSerial.cpp.patch
  5. 0 arduino/{petitrobot → othersgrosrobot}/driver/SConstruct
  6. 0 arduino/{petitrobot → othersgrosrobot}/driver/ax12.cpp
  7. 0 arduino/{petitrobot → othersgrosrobot}/driver/ax12.h
  8. 0 arduino/{grosrobot → othersgrosrobot}/driver/balais.cpp
  9. 0 arduino/{grosrobot → othersgrosrobot}/driver/balais.h
  10. 0 arduino/{grosrobot → othersgrosrobot}/driver/command.cpp
  11. 0 arduino/{grosrobot → othersgrosrobot}/driver/command.h
  12. 0 arduino/{grosrobot → othersgrosrobot}/driver/controleAX18.cpp
  13. 0 arduino/{grosrobot → othersgrosrobot}/driver/controleAX18.h
  14. +4 −1 arduino/{grosrobot → othersgrosrobot}/driver/driver.ino
  15. 0 arduino/{grosrobot → othersgrosrobot}/driver/idAX18.h
  16. 0 arduino/{petitrobot → othersgrosrobot}/driver/message.cpp
  17. 0 arduino/{petitrobot → othersgrosrobot}/driver/message.h
  18. +53 −0 arduino/othersgrosrobot/driver/ping.cpp
  19. +13 −0 arduino/othersgrosrobot/driver/ping.h
  20. 0 arduino/{grosrobot → othersgrosrobot}/driver/protocole.h
  21. 0 arduino/{grosrobot → othersgrosrobot}/driver/tapis.cpp
  22. 0 arduino/{grosrobot → othersgrosrobot}/driver/tapis.h
  23. 0 arduino/{petitrobot → otherspetitrobot}/clientIRC/samplebot.py
  24. 0 arduino/{grosrobot → otherspetitrobot}/driver/AFMotor.cpp
  25. 0 arduino/{grosrobot → otherspetitrobot}/driver/AFMotor.h
  26. 0 arduino/{grosrobot → otherspetitrobot}/driver/HardwareSerial.cpp.patch
  27. 0 arduino/{grosrobot → otherspetitrobot}/driver/SConstruct
  28. 0 arduino/{grosrobot → otherspetitrobot}/driver/ax12.cpp
  29. 0 arduino/{grosrobot → otherspetitrobot}/driver/ax12.h
  30. 0 arduino/{petitrobot → otherspetitrobot}/driver/command.cpp
  31. 0 arduino/{petitrobot → otherspetitrobot}/driver/command.h
  32. 0 arduino/{petitrobot → otherspetitrobot}/driver/controle_ax12.cpp
  33. 0 arduino/{petitrobot → otherspetitrobot}/driver/controle_ax12.h
  34. 0 arduino/{petitrobot → otherspetitrobot}/driver/driver.ino
  35. 0 arduino/{grosrobot → otherspetitrobot}/driver/message.cpp
  36. 0 arduino/{grosrobot → otherspetitrobot}/driver/message.h
  37. 0 arduino/{petitrobot → otherspetitrobot}/driver/percepteur.cpp
  38. 0 arduino/{petitrobot → otherspetitrobot}/driver/percepteur.h
  39. 0 arduino/{petitrobot → otherspetitrobot}/driver/protocole.h
  40. +18 −1 ia/ia/gamestate.py
  41. +7 −2 ia/ia/ia_utcoupe.py
  42. +1 −1 lib/py3irc/mypyirc/ircdefine.py
  43. +2 −0 protocole.h
View
0 arduino/grosrobot/clientIRC/othersbot.py → ...no/othersgrosrobot/clientIRC/othersbot.py
File renamed without changes.
View
0 arduino/petitrobot/driver/AFMotor.cpp → arduino/othersgrosrobot/driver/AFMotor.cpp
File renamed without changes.
View
0 arduino/petitrobot/driver/AFMotor.h → arduino/othersgrosrobot/driver/AFMotor.h
File renamed without changes.
View
0 ...etitrobot/driver/HardwareSerial.cpp.patch → ...grosrobot/driver/HardwareSerial.cpp.patch
File renamed without changes.
View
0 arduino/petitrobot/driver/SConstruct → arduino/othersgrosrobot/driver/SConstruct
File renamed without changes.
View
0 arduino/petitrobot/driver/ax12.cpp → arduino/othersgrosrobot/driver/ax12.cpp
File renamed without changes.
View
0 arduino/petitrobot/driver/ax12.h → arduino/othersgrosrobot/driver/ax12.h
File renamed without changes.
View
0 arduino/grosrobot/driver/balais.cpp → arduino/othersgrosrobot/driver/balais.cpp
File renamed without changes.
View
0 arduino/grosrobot/driver/balais.h → arduino/othersgrosrobot/driver/balais.h
File renamed without changes.
View
0 arduino/grosrobot/driver/command.cpp → arduino/othersgrosrobot/driver/command.cpp
File renamed without changes.
View
0 arduino/grosrobot/driver/command.h → arduino/othersgrosrobot/driver/command.h
File renamed without changes.
View
0 arduino/grosrobot/driver/controleAX18.cpp → ...o/othersgrosrobot/driver/controleAX18.cpp
File renamed without changes.
View
0 arduino/grosrobot/driver/controleAX18.h → ...ino/othersgrosrobot/driver/controleAX18.h
File renamed without changes.
View
5 arduino/grosrobot/driver/driver.ino → arduino/othersgrosrobot/driver/driver.ino
@@ -1,5 +1,5 @@
#include "command.h"
-
+#include "ping.h"
// initialisations
@@ -16,6 +16,9 @@ void loop()
{
timeStart = micros();
+ // ultra sons
+ usTrigger();
+
// lecture des données arrivant
readIncomingData();
View
0 arduino/grosrobot/driver/idAX18.h → arduino/othersgrosrobot/driver/idAX18.h
File renamed without changes.
View
0 arduino/petitrobot/driver/message.cpp → arduino/othersgrosrobot/driver/message.cpp
File renamed without changes.
View
0 arduino/petitrobot/driver/message.h → arduino/othersgrosrobot/driver/message.h
File renamed without changes.
View
53 arduino/othersgrosrobot/driver/ping.cpp
@@ -0,0 +1,53 @@
+#include "ping.h"
+
+unsigned int getDistance(unsigned char pingPin){
+ // establish variables for duration of the ping,
+ // and the distance result in inches and centimeters:
+ long duration;
+
+ // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
+ // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
+ pinMode(pingPin, OUTPUT);
+ digitalWrite(pingPin, LOW);
+ delayMicroseconds(2);
+ digitalWrite(pingPin, HIGH);
+ delayMicroseconds(5);
+ digitalWrite(pingPin, LOW);
+
+ // The same pin is used to read the signal from the PING))): a HIGH
+ // pulse whose duration is the time (in microseconds) from the sending
+ // of the ping to the reception of its echo off of an object.
+ pinMode(pingPin, INPUT);
+ duration = pulseIn(pingPin, HIGH);
+ return duration;
+}
+
+long microsecondsToInches(long int microseconds)
+{
+ // According to Parallax's datasheet for the PING))), there are
+ // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
+ // second). This gives the distance travelled by the ping, outbound
+ // and return, so we divide by 2 to get the distance of the obstacle.
+ // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
+ return microseconds / 74 / 2;
+}
+
+long microsecondsToCentimeters(long int microseconds)
+{
+ // The speed of sound is 340 m/s or 29 microseconds per centimeter.
+ // The ping travels out and back, so to find the distance of the
+ // object we take half of the distance travelled.
+ return microseconds / 58;
+}
+
+void usTrigger() {
+ static long long timePing = 0;
+ if (millis() - timePing > 100) {
+ timePing = millis();
+ int d = 0;
+
+ d = microsecondsToCentimeters(getDistance(PIN_PING));
+ sendMessage(ID_MSG_US,d);
+ }
+}
+
View
13 arduino/othersgrosrobot/driver/ping.h
@@ -0,0 +1,13 @@
+#ifndef PING_H_
+#define PING_H_
+
+#include <WProgram.h>
+
+unsigned int getDistance(unsigned char pingPin);
+long microsecondsToInches(long int microseconds);
+long microsecondsToCentimeters(long int microseconds);
+long usTrigger();
+
+#endif
+
+
View
0 arduino/grosrobot/driver/protocole.h → arduino/othersgrosrobot/driver/protocole.h
File renamed without changes.
View
0 arduino/grosrobot/driver/tapis.cpp → arduino/othersgrosrobot/driver/tapis.cpp
File renamed without changes.
View
0 arduino/grosrobot/driver/tapis.h → arduino/othersgrosrobot/driver/tapis.h
File renamed without changes.
View
0 arduino/petitrobot/clientIRC/samplebot.py → ...o/otherspetitrobot/clientIRC/samplebot.py
File renamed without changes.
View
0 arduino/grosrobot/driver/AFMotor.cpp → arduino/otherspetitrobot/driver/AFMotor.cpp
File renamed without changes.
View
0 arduino/grosrobot/driver/AFMotor.h → arduino/otherspetitrobot/driver/AFMotor.h
File renamed without changes.
View
0 ...grosrobot/driver/HardwareSerial.cpp.patch → ...etitrobot/driver/HardwareSerial.cpp.patch
File renamed without changes.
View
0 arduino/grosrobot/driver/SConstruct → arduino/otherspetitrobot/driver/SConstruct
File renamed without changes.
View
0 arduino/grosrobot/driver/ax12.cpp → arduino/otherspetitrobot/driver/ax12.cpp
File renamed without changes.
View
0 arduino/grosrobot/driver/ax12.h → arduino/otherspetitrobot/driver/ax12.h
File renamed without changes.
View
0 arduino/petitrobot/driver/command.cpp → arduino/otherspetitrobot/driver/command.cpp
File renamed without changes.
View
0 arduino/petitrobot/driver/command.h → arduino/otherspetitrobot/driver/command.h
File renamed without changes.
View
0 arduino/petitrobot/driver/controle_ax12.cpp → ...otherspetitrobot/driver/controle_ax12.cpp
File renamed without changes.
View
0 arduino/petitrobot/driver/controle_ax12.h → ...o/otherspetitrobot/driver/controle_ax12.h
File renamed without changes.
View
0 arduino/petitrobot/driver/driver.ino → arduino/otherspetitrobot/driver/driver.ino
File renamed without changes.
View
0 arduino/grosrobot/driver/message.cpp → arduino/otherspetitrobot/driver/message.cpp
File renamed without changes.
View
0 arduino/grosrobot/driver/message.h → arduino/otherspetitrobot/driver/message.h
File renamed without changes.
View
0 arduino/petitrobot/driver/percepteur.cpp → ...no/otherspetitrobot/driver/percepteur.cpp
File renamed without changes.
View
0 arduino/petitrobot/driver/percepteur.h → arduino/otherspetitrobot/driver/percepteur.h
File renamed without changes.
View
0 arduino/petitrobot/driver/protocole.h → arduino/otherspetitrobot/driver/protocole.h
File renamed without changes.
View
19 ia/ia/gamestate.py
@@ -60,7 +60,9 @@ def __init__(self, ircbot, canal_big_asserv, canal_mini_asserv, canal_big_visio,
self.sums = {}
self.sums['update_big_ng'] = {'t':0, 'n':0}
self.sums['update_mini_ng'] = {'t':0, 'n':0}
-
+
+ self.us_detect = False # pour l'homologation, si les ultra sons detectent quelque chose devant alors on s'arrête
+ self.set_handler(ID_MSG_US, self.on_msg_us)
def reset(self):
self.bigrobot.reset()
@@ -227,6 +229,21 @@ def on_msg_visio(self, n, canal, args, options):
else:
self.send_error(canal, "Error %s.on_msg_visio (%s:%d) : pas assez de paramètres " %
(self.__class__.__name__, currentframe().f_code.co_filename, currentframe().f_lineno))
+
+ def on_msg_us(self, n, canal, args, kwargs):
+ if len(args) == 1:
+ dist = int(args[0])
+ if dist < 200:
+ if not self.us_detect:
+ self.bigrobot.stop()
+ self.us_detect = True
+ else:
+ if self.us_detect:
+ self.bigrobot.resume()
+ self.us_detect = False
+ else:
+ self.send_error(canal, "Error %s.on_msg_us (%s:%d) : pas assez de paramètres " %
+ (self.__class__.__name__, currentframe().f_code.co_filename, currentframe().f_lineno))
def send_error(self, canal, msg):
if self.ircbot:
View
9 ia/ia/ia_utcoupe.py
@@ -148,6 +148,7 @@ def loopPlay(self):
# maj des actions
self.set_cd_actions(self.gamestate.objects)
+
# debug
"""
@@ -170,8 +171,12 @@ def loopPlay(self):
self.debug.draw_circle(o, 80, (255,0,0), 1, id(o))"""
# gogogo robots !
- self.loopRobot(self.gamestate.bigrobot)
- self.loopRobot(self.gamestate.minirobot) # decommenter
+ if not self.gamestate.us_detect:
+ self.loopRobot(self.gamestate.bigrobot)
+ else:
+ print("Les pings ont detectés un bolosse en face !!!")
+ #self.loopRobot(self.gamestate.minirobot) # decommenter
+
View
2 lib/py3irc/mypyirc/ircdefine.py
@@ -32,7 +32,7 @@
ID_MSG_POS = 101
ID_MSG_HOKUYO = 102
ID_MSG_JACK = 102
-
+ID_MSG_US = 104 # ultra son
BLUE = 0
RED = 1
View
2 protocole.h
@@ -58,6 +58,8 @@
#define QO_BOUGER_TRAPPE 5
+#define ID_MSG_HOKUYO 104
+
////////////////////////////////////////////////////////////////////////
//// ASSERV

No commit comments for this range

Something went wrong with that request. Please try again.