This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit, add the code of 2015
- Loading branch information
Showing
781 changed files
with
117,090 additions
and
2 deletions.
There are no files selected for viewing
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,21 @@ | ||
*.elf | ||
*.hex | ||
build/ | ||
.sconsign.dblite | ||
__pycache__/ | ||
node_modules/ | ||
npm-debug.log | ||
*.sublime* | ||
hokuyo/bin/hokuyo | ||
CMakeCache* | ||
CMakeFiles* | ||
cmake_install* | ||
*calculate_xy | ||
*find_port | ||
*get_distance | ||
*get_distance_intensity | ||
*get_multiecho | ||
*get_multiecho_intensity | ||
*sensor_parameter | ||
*sync_time_stamp | ||
*liburg_c.a |
Binary file not shown.
Binary file not shown.
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,11 @@ | ||
On host (with internet) : | ||
replace <output_interface> by network access interface (ex : wlan0) | ||
replace <input_interface> by network sharing interface (ex : eth0> | ||
|
||
sudo sysctl net.ipv4.ip_forward=1 | ||
sudo iptables -t nat -A POSTROUTING -o <output_interface> -j MASQUERADE | ||
sudo iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT | ||
sudo iptables -A FORWARD -i <input_interface> -o <output_interface> -j ACCEPT | ||
|
||
On target device : | ||
ip route add default via <host_ip> dev <device_interface> |
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 |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# coupe17 | ||
Attention la lune, on arrive ! #moonvillage | ||
Code source des robots d'UTCoupe 2015 | ||
======= | ||
|
||
Participation à la Coupe de France de Robotique 2015 dont le thème est : Robomovies | ||
|
||
Structure : | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,145 @@ | ||
// Adafruit Motor shield library | ||
// copyright Adafruit Industries LLC, 2009 | ||
// this code is public domain, enjoy! | ||
// Adapté pour UTCoupe2011 par Arthur, 19/01/2011 | ||
// Moteurs 1 et 2 correspondent à la carte Rugged | ||
|
||
|
||
#include <avr/io.h> | ||
#include <Arduino.h> | ||
|
||
|
||
#include "AFMotor.h" | ||
|
||
|
||
/****************************************** | ||
MOTORS | ||
******************************************/ | ||
inline void initPWM1(uint8_t freq) { | ||
#if defined(__AVR_ATmega8__) || \ | ||
defined(__AVR_ATmega48__) || \ | ||
defined(__AVR_ATmega88__) || \ | ||
defined(__AVR_ATmega168__) || \ | ||
defined(__AVR_ATmega328P__) | ||
// use PWM from timer2B (pin 3) | ||
TCCR2A |= _BV(COM2B1) | _BV(WGM20) | _BV(WGM21); // fast PWM, turn on oc2b | ||
TCCR2B = freq & 0x7; | ||
OCR2B = 0; | ||
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) | ||
// on arduino mega, pin 3 is now PE5 (OC3C) | ||
TCCR3A |= _BV(COM1C1) | _BV(WGM10); // fast PWM, turn on oc3c | ||
TCCR3B = (freq & 0x7) | _BV(WGM12); | ||
OCR3C = 0; | ||
|
||
#else | ||
#error "This chip is not supported!" | ||
#endif | ||
|
||
pinMode(3, OUTPUT); | ||
} | ||
|
||
inline void setPWM1(uint8_t s) { | ||
#if defined(__AVR_ATmega8__) || \ | ||
defined(__AVR_ATmega48__) || \ | ||
defined(__AVR_ATmega88__) || \ | ||
defined(__AVR_ATmega168__) || \ | ||
defined(__AVR_ATmega328P__) | ||
// use PWM from timer2A on PB3 (Arduino pin #11) | ||
OCR2B = s; | ||
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) | ||
// on arduino mega, pin 11 is now PB5 (OC1A) | ||
OCR3C = s; | ||
#else | ||
#error "This chip is not supported!" | ||
#endif | ||
} | ||
|
||
inline void initPWM2(uint8_t freq) { | ||
#if defined(__AVR_ATmega8__) || \ | ||
defined(__AVR_ATmega48__) || \ | ||
defined(__AVR_ATmega88__) || \ | ||
defined(__AVR_ATmega168__) || \ | ||
defined(__AVR_ATmega328P__) | ||
// use PWM from timer2A on PB3 (Arduino pin #11) | ||
TCCR2A |= _BV(COM2A1) | _BV(WGM20) | _BV(WGM21); // fast PWM, turn on oc2a | ||
TCCR2B = freq & 0x7; | ||
OCR2A = 0; | ||
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) | ||
// on arduino mega, pin 11 is now PB5 (OC1A) | ||
TCCR1A |= _BV(COM1A1) | _BV(WGM10); // fast PWM, turn on oc1a | ||
TCCR1B = (freq & 0x7) | _BV(WGM12); | ||
OCR1A = 0; | ||
#else | ||
#error "This chip is not supported!" | ||
#endif | ||
pinMode(11, OUTPUT); | ||
} | ||
|
||
inline void setPWM2(uint8_t s) { | ||
#if defined(__AVR_ATmega8__) || \ | ||
defined(__AVR_ATmega48__) || \ | ||
defined(__AVR_ATmega88__) || \ | ||
defined(__AVR_ATmega168__) || \ | ||
defined(__AVR_ATmega328P__) | ||
// use PWM from timer2A on PB3 (Arduino pin #11) | ||
OCR2A = s; | ||
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) | ||
// on arduino mega, pin 11 is now PB5 (OC1A) | ||
OCR1A = s; | ||
#else | ||
#error "This chip is not supported!" | ||
#endif | ||
} | ||
|
||
AF_DCMotor::AF_DCMotor(uint8_t num, uint8_t freq) { | ||
motornum = num; | ||
pwmfreq = freq; | ||
|
||
switch (num) { | ||
case 1: | ||
pinMode(MOTOR1_DIR, OUTPUT); | ||
digitalWrite(MOTOR1_DIR, LOW); | ||
initPWM1(freq); | ||
break; | ||
case 2: | ||
pinMode(MOTOR2_DIR, OUTPUT); | ||
digitalWrite(MOTOR2_DIR, LOW); | ||
initPWM2(freq); | ||
break; | ||
} | ||
} | ||
|
||
void AF_DCMotor::run(uint8_t cmd) { | ||
uint8_t dirPin; | ||
switch (motornum) { | ||
case 1: | ||
dirPin = MOTOR1_DIR; break; | ||
case 2: | ||
dirPin = MOTOR2_DIR; break; | ||
default: | ||
return; | ||
} | ||
|
||
switch (cmd) { | ||
case FORWARD: | ||
digitalWrite(dirPin, LOW); | ||
break; | ||
case BACKWARD: | ||
digitalWrite(dirPin, HIGH); | ||
break; | ||
case RELEASE: | ||
//TODO | ||
break; | ||
} | ||
} | ||
|
||
void AF_DCMotor::setSpeed(uint8_t speed) { | ||
switch (motornum) { | ||
case 1: | ||
setPWM1(speed); break; | ||
case 2: | ||
setPWM2(speed); break; | ||
} | ||
} | ||
|
||
|
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,46 @@ | ||
// Adafruit Motor shield library | ||
// copyright Adafruit Industries LLC, 2009 | ||
// this code is public domain, enjoy! | ||
|
||
#ifndef _AFMotor_h_ | ||
#define _AFMotor_h_ | ||
|
||
#include <inttypes.h> | ||
#include <avr/io.h> | ||
|
||
|
||
#define MOTOR12_64KHZ _BV(CS20) // no prescale | ||
#define MOTOR12_8KHZ _BV(CS21) // divide by 8 | ||
#define MOTOR12_2KHZ _BV(CS21) | _BV(CS20) // divide by 32 | ||
#define MOTOR12_1KHZ _BV(CS22) // divide by 64 | ||
|
||
#define MOTOR1_DIR 12 | ||
#define MOTOR2_DIR 13 | ||
|
||
#define MOTOR1_A 2 | ||
#define MOTOR1_B 3 | ||
#define MOTOR2_A 1 | ||
#define MOTOR2_B 4 | ||
#define MOTOR4_A 0 | ||
#define MOTOR4_B 6 | ||
#define MOTOR3_A 5 | ||
#define MOTOR3_B 7 | ||
|
||
#define FORWARD 1 | ||
#define BACKWARD 2 | ||
#define BRAKE 3 | ||
#define RELEASE 4 | ||
|
||
|
||
class AF_DCMotor | ||
{ | ||
public: | ||
AF_DCMotor(uint8_t motornum, uint8_t freq = MOTOR12_8KHZ); | ||
void run(uint8_t); | ||
void setSpeed(uint8_t); | ||
|
||
private: | ||
uint8_t motornum, pwmfreq; | ||
}; | ||
|
||
#endif |
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 @@ | ||
../asserv/asserv.ino |
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 @@ | ||
../asserv/PID.c |
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 @@ | ||
../asserv/PID.h |
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 @@ | ||
../SConstruct |
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 @@ | ||
../asserv/block.c |
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 @@ | ||
../asserv/block.h |
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 @@ | ||
../asserv/compat.cpp |
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 @@ | ||
../asserv/compat.h |
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 @@ | ||
../asserv/control.c |
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 @@ | ||
../asserv/control.h |
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 @@ | ||
../asserv/emergency.c |
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 @@ | ||
../asserv/emergency.h |
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 @@ | ||
../asserv/encoder.c |
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 @@ | ||
../asserv/encoder.h |
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 @@ | ||
../asserv/goals.c |
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 @@ | ||
../asserv/goals.h |
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 @@ | ||
../asserv/local_math.c |
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 @@ | ||
../asserv/local_math.h |
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,11 @@ | ||
#!/bin/bash | ||
|
||
export AVR_HOME=/usr/bin ARDUINO_HOME=../arduino-1.0 | ||
export ARDUINO_BOARD=mega2560 | ||
|
||
if ! ../check_protocol; then | ||
echo "Found duplicate value for orders in protocol.h" | ||
exit 1 | ||
fi | ||
|
||
scons -f ../SConstruct $@ |
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,61 @@ | ||
/**************************************** | ||
* Author : Quentin C * | ||
* Mail : [email protected] * | ||
* Date : 29/11/13 * | ||
****************************************/ | ||
#include "parameters.h" | ||
#include "AFMotor.h" | ||
#include <Arduino.h> | ||
|
||
#ifndef PWM_MIN | ||
#define PWM_MIN 0 | ||
#endif | ||
|
||
//Controleur : | ||
//-255:0 : Marche arrière | ||
//0:255 : Marche avant | ||
|
||
AF_DCMotor motor_left(1, MOTOR12_64KHZ); | ||
AF_DCMotor motor_right(2, MOTOR12_64KHZ); | ||
|
||
extern "C" void set_pwm_right(int pwm); | ||
extern "C" void set_pwm_left(int pwm); | ||
|
||
void set_pwm_left(int pwm){ | ||
pwm = -pwm;//les moteurs sont faces à face, pour avancer il faut qu'il tournent dans un sens différent | ||
if (pwm > 0) | ||
pwm += PWM_MIN; | ||
else if (pwm < 0) | ||
pwm -= PWM_MIN; | ||
|
||
if(pwm > 255) | ||
pwm = 255; | ||
else if(pwm < -255) | ||
pwm = -255; | ||
|
||
if(pwm >= 0) | ||
motor_left.run(FORWARD); | ||
else | ||
motor_left.run(BACKWARD); | ||
|
||
motor_left.setSpeed(abs(pwm)); | ||
} | ||
|
||
void set_pwm_right(int pwm){ | ||
if (pwm > 0) | ||
pwm += PWM_MIN; | ||
else if (pwm < 0) | ||
pwm -= PWM_MIN; | ||
|
||
if(pwm > 255) | ||
pwm = 255; | ||
else if(pwm < -255) | ||
pwm = -255; | ||
|
||
if(pwm >= 0) | ||
motor_right.run(FORWARD); | ||
else | ||
motor_right.run(BACKWARD); | ||
|
||
motor_right.setSpeed(abs(pwm)); | ||
} |
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,17 @@ | ||
/**************************************** | ||
* Author : Quentin C * | ||
* Mail : [email protected] * | ||
* Date : 31/03/13 * | ||
****************************************/ | ||
#ifndef MOTOR_H | ||
#define MOTOR_H | ||
|
||
void set_pwm(int side, int pwm); | ||
|
||
inline void MotorsInit(void) {}; | ||
|
||
void set_pwm_left(int pwm); | ||
|
||
void set_pwm_right(int pwm); | ||
|
||
#endif |
Oops, something went wrong.