le ROV de fefe ; evolution du projet.

Parlez de vos projets , problêmes rencontrés , proposez des solutions , posez des questions ...

Modérateurs : YODA, Louky

Avatar de l’utilisateur
fefenin
Messages : 196
Inscription : Mer Déc 05, 2007 7:32 pm
Localisation : Figeac,lot (46)

le ROV de fefe ; evolution du projet.

Messagepar fefenin » Mer Mai 14, 2008 7:29 pm

je salut le groupe de forumiste !!

j'ai ouvert ce sujet pour simplement donner au fur et a mesure des info sur l'évolution de mon sub!

voila donc:

vous aviez vu ou entendu parler du ROV Alvin qui avez étais conçu pour l'asso "telefigeac.com" (pour ce qui n'ont pas vu c'est rubrique promenade), apré se premier sousmarin opérationnel j'ai choisi de faire un autre sous marin moins esthétique mais plus performant, je me suis aperçu que commencer un sous marin a partir d'un coque (abillage) est bien trop contraignant .

ce nouveau ROV a étais conçu a partir de propulseurs (6) qui sont ensuite fixés sur un chassis alu , contrerement a l'Alvin les propulseurs sont a base de moteurs brushless noyée dans de l'huile de parrafin (pharmacie) pour des raissons écologiques.

jusque ici plusieurs essais ont etaient effectuer dans l'eau avec seulement 2 propulseurs, l'huile dans les caisson moteurs ne freine pas le fonctionnement , meme dans de l'eau a 12 degrés ...

actuellement une camera haute deffinition avec un grand angle de 120deg est monté sur le chassis avec deux propulseurs horizontaux, un tube de plexi de 110mm de diametre acceuil les vario plus la radio (pour les essais), un ombilic remonte la video jusqu'a l'opperateur.

deux exctincteurs de 112 mm de diametre ont etais recuperé pour remplacer le tube plexi (implose a 19 metres) , ces exctincteurs ont une pression de service de 50 ,60 bars une valve de securitée est tarée a 200 bars, et la Pression Epreuve est de 264bars.

ce nouveau tube a base d'exctincteur devrais me permetre des profondeurs confortable (le tube etanche etant la seul partie sensible, avec la camera, a la pression.)
je n'espere en aucun cas avoir 2640 metres de cable !!!!

deux nouveaux brushless ont etais bobiné hier reste a faire le corps pour recevoir l'huile, l'exctincteur a etait coupé en deux est rentre parfaitement dans le chassis.
reste a faire un bouchon avec ca boite de jonction (pleine d'huile) pour remplacer l'ancienne , qui a servie pour les test jusque la.
un compensateur de meilleur qualité que celui que j'utilise devrais etre fabriqué ( j'utilise une pochette baxter, poche pour perfusions)

la carte electronique de mon premier sousmarin va etre utilisé pour l'osd et les infos compas profondeurs...
une carte avec le protocol de se site vas etre fabriquer pour communiquer avec la surface!

un sonar est en prototypage avec un collegue .

et voilou pour le moment

je posterais des chose au fur a mesure si j'ai 5 minutes

bon bricolage a tous

fefenin
fefenin (exploboticien!)

retrouvez les infos locales de figeac sur :
http://www.telefigeac.com

Avatar de l’utilisateur
fefenin
Messages : 196
Inscription : Mer Déc 05, 2007 7:32 pm
Localisation : Figeac,lot (46)

Re: le ROV de fefe ; evolution du projet.

Messagepar fefenin » Mer Mai 14, 2008 9:44 pm

ImageImageImageImage ImageImageImage ImageImageImage ImageImageImage ImageImageImage ImageImageImage ImageImageImage ImageImageImage ImageImage
fefenin (exploboticien!)

retrouvez les infos locales de figeac sur :
http://www.telefigeac.com

Avatar de l’utilisateur
Louky
Messages : 899
Inscription : Sam Oct 22, 2005 6:33 am
Localisation : Var

Re: le ROV de fefe ; evolution du projet.

Messagepar Louky » Jeu Mai 15, 2008 6:09 pm

on dirais que "fefe" is back ! :wink:

mais je connais maintenant son secret pour être aussi productif ...
... il a un "chassistant" ! :lol:

sinon je dirais juste : trés beau ( et énorme ! ) boulot !
une carte avec le protocol de se site vas etre fabriquer pour communiquer avec la surface!


Pour mon petit dernier ( en cours de conception ) , je travaille sur une carte "universelle", regroupant les fonctions de bases d'un ROV.
j'en suis pour l'instant à la partie transmission : une petite carte annexe pour multiplexer vidéo et data sur un coax
La carte est routée, il faut que je la cable et que je fasse les tests.

Je passe ensuite dans la foulée sur la carte UC !

je ne garantie pas les délais de réalisation :shock: , mais j'espère avoir mon engin courant/fin d'été.
si ça te tente, on peut ouvrir un post pour que je te donne plus de détail ...

un sonar est en prototypage avec un collegue .


ça m'intérresse ! si tu as plus d'infos, je suis preneur !

PS : en ce moment toutes les notifications de réponses du forum échouent vers ton adresse hotmail ! ,
voir le sujet probleme des @ hotmail

Avatar de l’utilisateur
fefenin
Messages : 196
Inscription : Mer Déc 05, 2007 7:32 pm
Localisation : Figeac,lot (46)

Re: le ROV de fefe ; evolution du projet.

Messagepar fefenin » Ven Mai 16, 2008 10:24 am

salut!

yes i'm back!

ben je me disait qu'il y avais plus trop d'activité ici (tout le monde prend le soleil ou quoi!)
alors je post!

au fait je vous conseil vivement, un "chassistant" pour vous aidez dans votre tracaille :
par exemple passer sur votre carte pendant que vous la testez , jouer avec le fil de bobinage de vos moteurs ( ca le "chassistant" ca le fait devenir barge!!)
et bien d'autre...

merci pour le boulot mais il en reste encore beaucoup , et j'espere bien etre pret pour SUMMER 2009!!

pour la carte electronique je suis super interesser car je n'est aucune idée de coment demarrer la construction , mais je voulais que ma carte osd pression soit aussi la carte video data (donc ca colle assez bien avec tes envies Louky)

donc pour etre clair si tu veux ouvrir un sujet je le regarderais et y repondrais volontier!

pour le sonar j'ai juste commancer vraiment les test hier apres pas mal de deception et donc on en ai a la partie reception amplification detection de la tonalitée!

il y a pas mal de boulot mais ca fais un long moment qu'on y pense donc j'espere que ce truc marchera!

en attendant on a un super hydrophone!!!!
le gros avantage de notre sonar si ou quand il marchera c'est qu'il utilise des haut parleur piezzos style carte postale musicale (ca vaut 45 cents) et donc il n'ont pas de cavité et peuveut etre noyer dans l'huile..

enfin je ne garantis pas les delais mais des que j'ai des resultat je les soumet

enfin pour hotmail, je suis desolé mais je ne regarde que cette boite mail..
si cela vous enerve de recevoir les notifications d'erreur alors je pourrais peut etre desactiver les notifications de reponses ( de toute facon je viens voir le site de temps en temps)
sinon ben je veux bien laisser tel quel car je recois defois des notification de reponses (ca depend d'hotmail)

merci et bonne continuation a tous

jeremy
fefenin (exploboticien!)

retrouvez les infos locales de figeac sur :
http://www.telefigeac.com

Avatar de l’utilisateur
Louky
Messages : 899
Inscription : Sam Oct 22, 2005 6:33 am
Localisation : Var

Re: le ROV de fefe ; evolution du projet.

Messagepar Louky » Ven Mai 16, 2008 4:42 pm

ben je me disait qu'il y avais plus trop d'activité ici (tout le monde prend le soleil ou quoi!)


Tout à fait d'accord, je trouve aussi que c'est un peu mou ! :shock:
pourtant les stats montre qu'il y a beaucoup de lecteurs ( mais peu de posteurs ! )
alors ... trop timides les Rovistes ? :wink:

Le chassistant, j'ai essayé aussi, mais le mien sa spécialité c'est plutôt ...

chassistant.jpg

... la sieste !

donc pour etre clair si tu veux ouvrir un sujet je le regarderais et y repondrais volontier!


Le temps de mettre au clair mes notes et je fait un post sur le sujet !

PS : pas de soucis pour hotmail !
Vous ne pouvez pas consulter les fichiers insérés à ce message.

Avatar de l’utilisateur
fefenin
Messages : 196
Inscription : Mer Déc 05, 2007 7:32 pm
Localisation : Figeac,lot (46)

Re: le ROV de fefe ; evolution du projet.

Messagepar fefenin » Ven Mai 16, 2008 7:19 pm

ca suffit maintenant!!

debout le chat , il y a du taff, c'est valable pour vous les lecteurs d' explobotique, a vos tours,fraiseuses, ordis etc...

y'a un meeting de peut etre prevu, vous voulez pas rater cette magnifique rencontre ?

bon aller, j'arrête de délirer, faites comme vous voulez mais on vas pas vous manger, vous pouvez partager vos idées avec nous...

a bientôt sur le forum!
fefenin (exploboticien!)

retrouvez les infos locales de figeac sur :
http://www.telefigeac.com

Avatar de l’utilisateur
fefenin
Messages : 196
Inscription : Mer Déc 05, 2007 7:32 pm
Localisation : Figeac,lot (46)

Re: le ROV de fefe ; evolution du projet.

Messagepar fefenin » Mer Juin 04, 2008 2:13 pm

salut a tous!

j'ai pas mal de souci avec le sonar donc je met de coté pour le moment ... de toutes facon j'ai encore un boite de jonction est 4 propulseurs a finir.

pour plus de facilitée je pense les faire en pvc de 50mm par contre je trouve pas la matiere de se diametre pour faire les bouchons!
d'ailleurs je trouuve pas d'arbre inox de 5mm avec son joint a levre non plus...

je sais que vous m'aviez donné des infos sur ou trouver ca.. mais je trouve pas de 50 mm .

ensuite je voulais savoir si le joint de vos bouchon suffit car l'interieur du tube n'est pas tout a fait lisse (voir pas du tout)
avez vous usiner l'interieur ou fait quelque chose sur vos props??

a bientot tous!
fefenin (exploboticien!)

retrouvez les infos locales de figeac sur :
http://www.telefigeac.com

Avatar de l’utilisateur
Louky
Messages : 899
Inscription : Sam Oct 22, 2005 6:33 am
Localisation : Var

Re: le ROV de fefe ; evolution du projet.

Messagepar Louky » Mer Juin 04, 2008 3:56 pm

Aluatous !

pour le PVC le dernier je l'ai pris chez OTELO ici en diam 50mm rouge
( il existe aussi en noir ou en gris, mais je trouve le rouge plus sympa ! :D )

Abre Inox et joints à levres de 5mm, une seule adresse LECMA !
( en plus, de la part d'Explobotique on est toujours bien accueillit :wink: )
Il fait aussi les coupleurs d'axes ...

ensuite je voulais savoir si le joint de vos bouchon suffit car l'interieur du tube n'est pas tout a fait lisse (voir pas du tout)
avez vous usiner l'interieur ou fait quelque chose sur vos props??


pour les props, je n'ai pas eu de soucis, que ce soit avec du tube PVC ( DIXI ou Ptipi ) ou du tube alu ( voir prop 720BB )
juste un petit coup de papier de verre trés fin suivi d'un petit coup de pate à polir en faisant tourner le tube au tour.
( attention les doigts ! :twisted: )

en ce qui me concerne j'utilise du joint avec fil de 3mm, ça permet aussi de rattraper pas mal
en plus, pour les props, on est en équipression alors c'est tranquille ... :D

voilou !

Avatar de l’utilisateur
fefenin
Messages : 196
Inscription : Mer Déc 05, 2007 7:32 pm
Localisation : Figeac,lot (46)

Re: le ROV de fefe ; evolution du projet.

Messagepar fefenin » Mar Déc 08, 2009 1:12 pm

salut,

je sais pas si j'ai deja posté cette video , mais voici mes derniers essais du soft !!!!

http://www.youtube.com/watch?v=JUKbFmn8RHY

grace au conseil trouveé sur ce site je me retrouve maintenant avec un ROV super maneuvrable qui peu plonger a des profondeur dingue!

ca fait longtemps que j'ai rien poster a cause des ROV volants (prise de vu aerienne est autopilot).

hesitez pas a commenter mes videos

a bientot et bon bricolage
fefenin (exploboticien!)

retrouvez les infos locales de figeac sur :
http://www.telefigeac.com

Avatar de l’utilisateur
Louky
Messages : 899
Inscription : Sam Oct 22, 2005 6:33 am
Localisation : Var

Re: le ROV de fefe ; evolution du projet.

Messagepar Louky » Mar Déc 08, 2009 5:20 pm

ça c'est ce qu'on peut appeler un ROV Vif et Maniable !!!

Attention les poissons, si vous le croisez, il va y avoir des "souchis" ... :lol: :lol: :lol:
( je suppose que les protections sont unes des prochaines étapes )

En tout cas bravo et longue vie à Yellow Turtle !

... je parie que le flotteur sera jaune et ressemblera à une carapace de tortue !? :wink:

Avatar de l’utilisateur
fefenin
Messages : 196
Inscription : Mer Déc 05, 2007 7:32 pm
Localisation : Figeac,lot (46)

Re: le ROV de fefe ; evolution du projet.

Messagepar fefenin » Jeu Nov 10, 2011 4:14 pm

salut l'equipe!!

desoler de ne pas jamais avoir repondu a ce post...
j'etais tres occupé a monter une asso de prise de vues aerienne (pour ce que ca interresse :http://www.pointciel.fr)
mais voici mon "come back" et oui le floteur sera jaune avec des dessins comme les tortues, pour les protections , ca y est !

mon sub est resté en stand by tout ce temps, mais c'est dernier jours il a subit quelques mods , ce soir c'est le test.

en attendant voici un petit descriptif video:

http://www.youtube.com/watch?v=bkLq8xxJwbs

ps: je viens de voir la video de descriptif de vos projets, c'est vraiment super ce que vous faites , dommage qu'il y es autant de soucis/contre temps.
il faut absolument que vous continuiez
fefenin (exploboticien!)

retrouvez les infos locales de figeac sur :
http://www.telefigeac.com

GBDF1
Messages : 40
Inscription : Sam Mai 28, 2011 7:09 am

Re: le ROV de fefe ; evolution du projet.

Messagepar GBDF1 » Ven Nov 25, 2011 9:08 pm

salut fefenin,

je t'avais envoyé il y a quelque temps un mail perso pour avoir les plan de tes cartes electroniques que tu utilisé ainsi que les codes sources que tu utilisé dans tes pics car je me souvient que louky t'avait un peu aidé sur la programmations des different axes de navigations car c'etait pas si simple.
j'aimerai savoir si tu peut mettre les plans des CI que tu utilise sur le forum avec les hex (ou liens pour codes source)et ce que tu utilise comme osd car cela pourra interressé les futur personnes qui seront interressé par la construction d'un rov ( un peu comme louky et yoda car c'est grace a eux et a leur explications technique sur le site que j'ai decider de me lancer dans l'aventure)

ca fait quelque moi que j'ai commencer j'ai tout le materiel mais j'aimerai bien avoir tout ces renseignement qui pourron etre tres interressant

merci

gael

Avatar de l’utilisateur
fefenin
Messages : 196
Inscription : Mer Déc 05, 2007 7:32 pm
Localisation : Figeac,lot (46)

Re: le ROV de fefe ; evolution du projet.

Messagepar fefenin » Ven Nov 25, 2011 10:26 pm

bonjour,

je n'ai jamais recu ton email semble t 'il !
je fais donc passer mes schemas + mes codes , il y a deux cartes une en surfaces avec controlleur playstation a base de pic18f1320, la partie sous marin est a base de 18f458.

le code source est en proton ide (picbasic) il est bugger mais fonctionne, il est mal documenté, il doit pouvoir etre editer avec n'importe quel bloc note.

le circuit osd est la vielle version de celui ci : http://www.icircuits.com/store/prod_osd232_plus.html il n'existe plus et je ne sais pas si celui ci est 100% compatible avec mon soft.

Image

Image

Image

Image

Image

je poste les code ici sous forme de texte

merci de ne pas utiliser ce travail a des fin commerciales

'****************************************************************
Device = 18F1320
Declare Bootloader = off
'THIS CONFIG IS FOR THE INTERNAL 8 MHZ OSCILLATOR, AND MCLRE OFF
Config_Start
OSC = HS'INTIO2 ; Internal RC, OSC1 as RA7, OSC2 as RA6
FSCM = OFF ; Fail-Safe Clock Monitor disabled
IESO = OFF ; Internal External Switch Over mode disabled
PWRT = On ; Enabled
BOR = OFF ; Disabled
BORV = 27 ; 4.2V
WDT = OFF ; Disabled
WDTPS = 64 ; 1:64
MCLRE = off ; Disabled
STVR = OFF ; Disabled
LVP = OFF ; Disabled
Debug = OFF ; Disabled
CP0 = OFF ; Disabled
CP1 = OFF ; Disabled
CPB = OFF ; Disabled
CPD = OFF ; Disabled
WRT0 = OFF ; Disabled
WRT1 = OFF ; Disabled
WRTB = OFF ; Disabled
WRTC = OFF ; Disabled
WRTD = OFF ; Disabled
EBTR0 = OFF ; Disabled
EBTR1 = OFF ; Disabled
EBTRB = OFF ; Disabled
Config_End


' ____ _____
'Board Volts>-|RA0 RB3|->beeper
' Lcd<-|RA1 RB2|->PS2_CLK
' Video LOS>-|RA4 RA7|-Xtal
' MCLR>-|RA5 RA6|-Xtal
' Gnd>-|Vss 18F Vdd|-<+5
' -|RA2 1320 RB7|-<PS2_DAT
' -|RA3 RB6|->PS2_CMD
' TX/RX Sens<-|RB0 RB5|->PS2_ATT
' TX<-|RB1 RB4|-<RX

All_Digital = TRUE ' We only want digital functions
PortB_Pullups = off
' CMCON0 = %00000111 ' Only if you don't trust "ALL_DIGITAL" :-)
' ADCON0 = 0 ' Only if you don't trust "ALL_DIGITAL" :-)
' ANSEL = %00000000 ' Only if you don't trust "ALL_DIGITAL" :-)
' INTCON.7 = 0 ' Only if you don't trust "ALL_DIGITAL" :-)
' INTCON2.7 = 1 'disable B pullups
' WPU.2 = 1 ' Only if you don't trust "ALL_DIGITAL" :-)
' OSCCON = %01110010 ' Internal OSC 8MHz
' OSCTUNE = %00000000 ' Fine tune the timing of the pulses, "0" uses default

Xtal = 10 'Proton clock setting (just for calculations)


init:
Disable
'OSCCON = %0111000 ' Internal x MHz osc %01100000
TRISA = %11111101
TRISB = %10010000
'Serial LCD:
Symbol lcd = PORTA.1
Symbol bds = 32 ' 19200 188'4800 bds
Symbol TX_bds = 32'84
'Ps2 controller:
Symbol dat = PORTB.7 'need a pull up' Play Station game controller connections.
Symbol cmd = PORTB.6
Symbol att = PORTB.5
Symbol clk = PORTB.2
'ack is not plugged
'beeper:
Symbol bip = PORTB.3
'rs485:
Symbol TX = PORTB.1
Symbol RX = PORTB.4
Symbol Tx_Rx_Sens = PORTB.0

Dim psxmode As Byte ' Variable definitions.
Dim psx_dummy As Byte
Dim psxbutton_1 As Byte ' Variable definitions.
Dim psxbutton_2 As Byte
Dim psxjoystick_1 As Dword'Byte
Dim psxjoystick_2 As Dword'Byte
Dim psxjoystick_3 As Dword'Byte
Dim psxjoystick_4 As Dword'Byte
Dim psxjoystick_1_Cal As Dword
Dim psxjoystick_2_Cal As Dword
Dim psxjoystick_3_Cal As Dword
Dim psxjoystick_4_Cal As Dword
Dim Center As Byte
' Dim voie1 As Byte
' Dim voie2 As Byte
' Dim voieA As Byte
' Dim voieB As Byte
' Dim voieC As Byte
' Dim voieD As Byte
Dim S_motor As Byte
Dim B_motor As Byte
Dim up As Bit
Dim down As Bit
Dim right As Bit
Dim left As Bit
Dim selec As Bit
Dim start As Bit
Dim L_stick As Bit
Dim R_stick As Bit
Dim cross As Bit
Dim trian As Bit
Dim round As Bit
Dim squar As Bit


Dim M_f_r As Dword
Dim M_f_l As Dword
Dim M_r_l As Dword
Dim M_r_r As Dword

DelayMS 1000
SerOut lcd,bds,[$A0]
DelayMS 100
SerOut lcd,bds,[$A3,$01]',$A5,$02]
SerOut lcd,bds,[$A1,1,0]'place cursor on x y
SerOut lcd,bds,[$A2,"PS2 Controller",$00] 'elcd
DelayMS 1000
SerOut lcd,bds,[$A3,$01]',$A5,$02]

'gosub Esc 'init the servos or esc


'software starts here
main:

GoSub config_mode 'run config mode at startup
'gosub init_dualshock 'doesn't work!?
GoSub analog_lock 'set the pad to analog mode with analog button lock

'GoSub digital_lock
GoSub exit_config_mode 'all settings ok ,exit the config mode
DelayMS 200
GoSub config_mode 'run config mode at startup
'gosub init_dualshock 'doesn't work!?
GoSub vibration_en 'set analog vibration to enable (default is probably disable)

GoSub exit_config_mode 'all settings ok ,exit the config mode
DelayMS 200
GoSub get_buttons_sticks 'get all datas from the pad

psxjoystick_1_Cal = 0
psxjoystick_2_Cal = 0
psxjoystick_3_Cal = 0
psxjoystick_4_Cal = 0

GoSub calibration

Sound bip, [50,60,70,20,85,120]
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
loop: 'main loop

GoSub get_buttons_sticks 'get all datas from the pad
'DelayMS 500 'wait before vibrate both motors
'debuging on lcd

'vibrate big motor
If psxbutton_2 = $FE Then
S_motor = $00 '$01
B_motor = $FF
GoSub vibration_run 'vibrate motors (see file ps2cmd01.txt to change the speed)
EndIf
'vibrate small motor
If psxbutton_1 = $FE Then
S_motor = $FF '$01
B_motor = $00
GoSub vibration_run 'vibrate motors (see file ps2cmd01.txt to change the speed)
EndIf

'display datas from get_buttons_sticks subroutine on a serial lcd (alcd from selectronic)
'GoSub louky_mix




GoSub louky_mix 'get the mixes and sort out the 6 motors values

High Tx_Rx_Sens
'send the motors vlues mixed all together + buttons @ 19200 'M_f_r = Y - X - Z
'M_f_l = Y + X + Z
'M_r_l = -Y + X - Z
'M_r_r = -Y - X + Z
SerOut TX,TX_bds,["@","A",Dec3 M_f_r,"B",Dec3 M_r_l,"C",Dec3 M_f_l ,"D",Dec3 M_r_r,"E",Dec3 psxjoystick_4,"F", psxbutton_1,"G", psxbutton_2,"*",$0A,$0D]

'send the joystick an buttons values for debug @19200bds
'SerOut TX,bds,["@","A",DEC3 psxjoystick_1,"B",DEC3 psxjoystick_2,"C",DEC3 psxjoystick_3,"D",DEC3 psxjoystick_4,"E",psxbutton_1,"F",psxbutton_2,"*"] 'when going the opposite way turn right to go back

'Debug with ELCD On this uc board:
'////////////////////////////////////////////
'SerOut lcd,bds,[$A1,0,0,$A2,Bin8 psxbutton_1,",",Bin8 psxbutton_2,$00,$A1,0,1,$A2,Dec3 psxjoystick_1,",",Dec3 psxjoystick_2,",",Dec3 psxjoystick_3,",",Dec3 psxjoystick_4,$00]
'////////////////////////////////////////////

'SerOut lcd,bds,[$A1,0,0,$A2,DEC3 M_f_l,":",DEC3 M_f_r,$00,$A1,0,1,$A2,DEC3 M_r_l ,":",DEC3 M_r_r," ",DEC3 psxjoystick_4,$00]
'SerOut lcd,bds,[$A1,9,0,$A2,DEC3 psxjoystick_1,":",DEC3 psxjoystick_2,$00,$A1,9,1,$A2,DEC3 psxjoystick_3,":",DEC3 psxjoystick_4,$00]


'DelayMS 10
Low Tx_Rx_Sens 'ready to receive

'SerOut lcd,bds,[$A1,0,0,$A2,BIN8 psxbutton_1,",",BIN8 psxbutton_2,$00,$A1,0,1,$A2,DEC3 psxjoystick_1,",",DEC3 psxjoystick_2,",",DEC3 psxjoystick_3,",",DEC3 psxjoystick_4,$00]

GoTo loop 'again and again

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
calibration:

Center = 128 'cause not divided by two yet
'needs togo To get sticks subroutine first
psxjoystick_1_Cal = psxjoystick_1
psxjoystick_2_Cal = psxjoystick_2
psxjoystick_3_Cal = psxjoystick_3
psxjoystick_4_Cal = psxjoystick_4

'serOut lcd,bds,[$A1,0,0,$A2,DEC3 psxjoystick_1_cal,":",DEC3 psxjoystick_2_cal,$00,$A1,0,1,$A2,DEC3 psxjoystick_3_cal,":",DEC3 psxjoystick_4_cal,$00]

psxjoystick_1_Cal = psxjoystick_1_Cal - Center
psxjoystick_2_Cal = psxjoystick_2_Cal - Center
psxjoystick_3_Cal = psxjoystick_3_Cal - Center
psxjoystick_4_Cal = psxjoystick_4_Cal - Center

'SerOut lcd,bds,[$A1,9,0,$A2,sDEC3 psxjoystick_1_Cal,":",sDEC3 psxjoystick_2_Cal,$00,$A1,9,1,$A2,sDEC3 psxjoystick_3_Cal,":",sDEC3 psxjoystick_4_Cal,$00]

Return
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


louky_mix:

'joystick comes from 0 to 255
'we want it from 1 to 128
'rezero with true joystick values
psxjoystick_1 = psxjoystick_1 - psxjoystick_1_Cal
psxjoystick_2 = psxjoystick_2 - psxjoystick_2_Cal
psxjoystick_3 = psxjoystick_3 - psxjoystick_3_Cal
psxjoystick_4 = psxjoystick_4 - psxjoystick_4_Cal

'limit Z and X mix from 1 to 255
If psxjoystick_1 > 178 Then psxjoystick_1 = 178
If psxjoystick_1 < 78 Then psxjoystick_1 = 78
If psxjoystick_3 > 188 Then psxjoystick_3 = 188
If psxjoystick_3 < 68 Then psxjoystick_3 = 68


'SerOut lcd,bds,[$A1,0,0,$A2,DEC3 psxjoystick_1,":",DEC3 psxjoystick_2,$00,$A1,0,1,$A2,DEC3 psxjoystick_3,":",DEC3 psxjoystick_4,$00]


'dead band and stretching
''''''''''''''''''''''''
Select psxjoystick_1

Case 0 To 111
psxjoystick_1 = psxjoystick_1 + 22

Case 106 To 150
psxjoystick_1 = 128

Case 145 To 255
psxjoystick_1 = psxjoystick_1 - 22

'CASE ELSE ' Otherwise...
' psxjoystick_1 = 128

EndSelect
''''''''''''''''''''''
Select psxjoystick_2

Case 0 To 111
psxjoystick_2 = psxjoystick_2 + 17

Case 111 To 145
psxjoystick_2 = 128

Case 145 To 255
psxjoystick_2 = psxjoystick_2 - 17

'Case Else ' Otherwise...
' psxjoystick_2 = 128

EndSelect
''''''''''''''''''''''''''''
Select psxjoystick_3

Case 0 To 111
psxjoystick_3 = psxjoystick_3 + 22

Case 106 To 150
psxjoystick_3 = 128

Case 145 To 255
psxjoystick_3 = psxjoystick_3 - 22

'Case Else ' Otherwise...
' psxjoystick_3 = 128

EndSelect
''''''''''''''''''''''''
Select psxjoystick_4

Case 0 To 111
psxjoystick_4 = psxjoystick_4 + 17

Case 111 To 145
psxjoystick_4 = 128

Case 145 To 255
psxjoystick_4 = psxjoystick_4 - 17

'Case Else ' Otherwise...
' psxjoystick_1 = 128

EndSelect

'SerOut lcd,bds,[$A1,9,0,$A2,DEC3 psxjoystick_1,":",DEC3 psxjoystick_2,$00,$A1,9,1,$A2,DEC3 psxjoystick_3,":",DEC3 psxjoystick_4,$00]



' dive psxjoystick_4 throttle (Y) psxjoystick_2
'HHHHHHHHH HHHHHHHHH
'H H H H
'H O H Rudder (X) psxjoystick_3 H O H travelling (Z) psxjoystick_1
'H H H H
'HHHHHHHHH HHHHHHHHH


'pour les moteurs :
'M_f_r = avant droit , sens positif propulse vers avant gauche
'M_f_l = avant gauche , sens positif propulse vers avant droit
'M_r_l = arriere gauche , sens positif propulse vers avant droit
'M_r_r = arriere droit , sens positif propulse vers avant gauche

'( les moteurs avant tirent vers l'avant, les arrières, vers l'arrière ! )

'pour les mixages je pensais à un truc trés simple du genre :
'M_f_r = Y - X - Z
'M_f_l = Y + X + Z
'M_r_l = -Y + X - Z
'M_r_r = -Y - X + Z

'Ensuite il suffit de tronquer les valeurs comme pour l'exemple du p'tipi.

'Pour améliorer, il est aussi possible de prévoir deux coeff de pondération :
'un pour X et Y ( commun au 2 axes ) et un pour Z, pour affiner les réactions en fonction des tests


''''''''''works''''''''''''''''''''''''''''''''''
M_f_r = (psxjoystick_1-128)
M_f_r = M_f_r + (psxjoystick_3-128)
M_f_r = M_f_r - (psxjoystick_2-128)
M_f_l = -(psxjoystick_1-128)
M_f_l = M_f_l - (psxjoystick_3-128)
M_f_l = M_f_l - (psxjoystick_2-128)
M_r_r = -(psxjoystick_1-128)
M_r_r = M_r_r + (psxjoystick_3-128)
M_r_r = M_r_r - (psxjoystick_2-128)
M_r_l = (psxjoystick_1-128)
M_r_l = M_r_l - (psxjoystick_3-128)
M_r_l = M_r_l - (psxjoystick_2-128)
''''''''''''''''''''''''''''''''''''''''''''''''''''
'offset
M_f_r = M_f_r + 128
M_r_l = M_r_l + 128
M_f_l = M_f_l + 128
M_r_r = M_r_r + 128


'scale to get 1 to 128
M_f_r = M_f_r/2
M_r_l = M_r_l/2
M_f_l = M_f_l/2
M_r_r = M_r_r/2
psxjoystick_4 = psxjoystick_4/2

'protection
If M_f_r >=128 Then M_f_r = 128
If M_f_r <=1 Then M_f_r = 1
If M_r_l >=128 Then M_r_l = 128
If M_r_l <=1 Then M_r_l = 1
If M_f_l >=128 Then M_f_l = 128
If M_f_l <=1 Then M_f_l = 1
If M_r_r >=128 Then M_r_r = 128
If M_r_r <=1 Then M_r_r = 1
If psxjoystick_4 >=128 Then psxjoystick_4 = 128
If psxjoystick_4 <=1 Then psxjoystick_4 = 1
'


'deadband:
'If 71 > M_f_r And 57 < M_f_r Then M_f_r = Center
'If 71 > M_r_l And 57 < M_r_l Then M_r_l = Center
'If 71 > M_f_l And 57 < M_f_l Then M_f_l = Center
'If 71 > M_r_r And 57 < M_r_r Then M_r_r = Center

'debuging on lcd
'SerOut lcd,bds,[$A1,0,0,$A2,SDEC3 M_f_r,",",SDEC3 M_f_l," ",$00,$A1,0,1,$A2,SDEC3 M_r_r,",",SDEC3 M_r_l," ",$00]

Return

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

get_buttons_sticks:
' The first shiftin gets the mode. (73) (my pic is not fast enaught to get the first byte send by the pad it gets next byte 5A instead)
' The next 2 shiftins gets the pushbutton data.
' The next 4 shiftins gets the analog joystick data.
Low att
SHOut cmd,clk,lsbfirst_h,[$01,$42] ' Initiate request for data from PSX controller.
SHIn dat,clk,lsbpost_h,[psxmode,psxbutton_1,psxbutton_2,psxjoystick_1,psxjoystick_2,psxjoystick_3,psxjoystick_4]
High att
Return
'SerOut lcd,bds,[$A1,0,1,hex psxdata[3],",",hex psxdata[5],",",hex psxdata[1]] 'see what is changing...
'SerOut lcd,bds,[$A1,0,2,hex psxdata[4],",",hex psxdata[6],",",hex psxdata[2]]

config_mode:
Low att
SHOut cmd,clk,lsbfirst_h,[$01,$43,$00,$01,$00] 'simply send config_mode data on command line
SHIn dat,clk,lsbpost_h,[psxmode,psxbutton_1,psxbutton_2,psxjoystick_1,psxjoystick_2,psxjoystick_3,psxjoystick_4]
High att
Return

init_dualshock:
Low att
SHOut cmd,clk,lsbfirst_h,[$01,$4D,$00,$00,$01] 'simply send init_dualshock data on command line
SHIn dat,clk,lsbpost_h,[psxmode,psxbutton_1,psxbutton_2,psxjoystick_1,psxjoystick_2,psxjoystick_3,psxjoystick_4]
High att
Return

vibration_en:
Low att
SHOut cmd,clk,lsbfirst_h,[$01,$4D,$00,$00,$01]
'SHIn dat,clk,lsbpost_h,[psxmode,psxbutton_1,psxbutton_2,psxjoystick_1,psxjoystick_2,psxjoystick_3,psxjoystick_4]
High att
Return

vibration_run:
Low att
SHOut cmd,clk,lsbfirst_h,[$01,$42,$00,S_motor,B_motor]'instead od $FF >,psxjoystick_1]
'SHOut cmd,clk,lsbfirst_h,[$01,$42,$00,$FF,$FF]
'look's like we don't need to get data in the config mode so the line underneath is not necessary!
SHIn dat,clk,lsbpost_h,[psx_dummy,psx_dummy,psx_dummy,psx_dummy]',psxjoystick_1,psxjoystick_2,psxjoystick_3,psxjoystick_4]
High att
Return

analog_lock:
Low att
SHOut cmd,clk,lsbfirst_h,[$01,$44,$00,$01,$03] '$03 lock the mode $01 (analog)
SHIn dat,clk,lsbpost_h,[psxmode,psxbutton_1,psxbutton_2,psxjoystick_1,psxjoystick_2,psxjoystick_3,psxjoystick_4]
High att
Return

digital_lock:
Low att
SHOut cmd,clk,lsbfirst_h,[$01,$44,$00,$00,$03]
'SHIn dat,clk,lsbpost_h,[,psxbutton_1,psxbutton_2,psxjoystick_1,psxjoystick_2,psxjoystick_3,psxjoystick_4]
High att
Return


exit_config_mode:
Low att
SHOut cmd,clk,lsbfirst_h,[$01,$43,$00,$00,$5A]
SHIn dat,clk,lsbpost_h,[psxmode,psxbutton_1,psxbutton_2,psxjoystick_1,psxjoystick_2,psxjoystick_3,psxjoystick_4]
High att
Return
End

Esc:
'init the servos or esc
SerOut TX,16780 ,["T","A",Dec 64,13,"T","B",Dec 64,13,"T","C",Dec 64,13,"T","D",Dec 64,13]
SerOut TX,16780 ,["T","A",Dec 64,13,"T","B",Dec 64,13,"T","C",Dec 64,13,"T","D",Dec 64,13]
DelayMS 5000
SerOut TX,16780 ,["T","A",Dec 1,13,"T","B",Dec 1,13,"T","C",Dec 1,13,"T","D",Dec 1,13]
DelayMS 2000
SerOut TX,16780 ,["T","A",Dec 64,13,"T","B",Dec 64,13,"T","C",Dec 64,13,"T","D",Dec 64,13]
Return







'****************************************************************
Device = 18F458
Declare Bootloader = off
'We'll use a 16-bit core device
@CONFIG_REQ
@__CONFIG config1h, OSCS_ON_1 & HSPLL_OSC_1
@__CONFIG config2l, BOR_OFF_2 & PWRT_ON_2
@__CONFIG config2h, WDT_OFF_2
@__CONFIG config4l, STVR_OFF_4 & LVP_OFF_4 & DEBUG_OFF_4

Xtal = 10
Declare PLL_Req = On '40 mhz
'

' _________________
' 5V>R10k>-|MCLE RB7|-<>One Wire
' voltage>-|RA0 RB6|->MIC800 reset
' -|RA1 RB5|-
' -|RA2 RB4|-
' -|RA3 RB3|-
' -|RA4 18F458 RB2|-
' -|RA5 RB1|-
' -|RE0 RB0|-
' -|RE1 Vdd|-<+5
' -|RE2 Vss|-<GND
' +5>-|Vdd RD7|->PWM lamp_D
' GND>-|Vss RD6|->PWM lamp_C
' 10Mhz XTAL -|OSC1 RD5|->PWM lamp_B
' 10Mhz XTAL -|OSC2 RD4|->PWM lamp_A
' -|RC0 RC7/RX|-<RS232
' -|RC1 RC6/TX|->RS232
' -|RC2 RC5|->Tx_Rx_Sens
' I2C_SCL<-|RC3 RC4|-<>I2C_SDA
' Cable LOS>-|RD0 RD3|-
'S_RS232_MIC<-|RD1___________RD2|->RS232_OSD
'


Optimiser_Level = 3 ' Full optimisation
Dead_Code_Remove = On ' Remove redundant ASM mnemonics

'

TRISA = %111111 'all porta is input exepte for RA4
TRISB = %10011111 'all portb is input
TRISC = %10010111 'all portc is input
TRISD = %1001 'high part of the portD is servos output first byte is del
TRISE = %111 'all porte is input

PortB_Pullups = off
Float_Display_Type = STANDARD 'large


ADCON1 = %11001110
Declare Adin_Res 10 ' 10-bit result required
Declare Adin_Tad FRC '32_FOSC' ' RC OSC chosen
Declare Adin_Stime 4 ' Allow 3us sample time

'disable comparator to make SDcard works:
CMCON = %11111111

' Create some variables

'variables:

Dim heading As Word
Dim pitch As Byte
Dim roll As Byte
'
Dim Bytein As Byte
Dim Xpos As Byte

Dim Volts As Float

Dim M_f_r As Byte
Dim M_f_l As Byte
Dim M_r_l As Byte
Dim M_r_r As Byte

Dim M_r_r_Cal As Byte
Dim M_f_r_Cal As Byte
Dim M_f_l_Cal As Byte
Dim M_r_l_Cal As Byte

Dim DB_min As Byte
Dim DB_max As Byte

Dim M_f_r_True_Center As Dword
Dim M_r_l_True_Center As Dword
Dim M_f_l_True_Center As Dword
Dim M_r_r_True_Center As Dword

Dim psxjoystick_4 As Byte

Dim up As Bit
Dim down As Bit
Dim right As Bit
Dim left As Bit
Dim selec As Bit
Dim start As Bit
Dim L_stick As Bit
Dim R_stick As Bit
Dim cross As Bit
Dim trian As Bit
Dim round As Bit
Dim squar As Bit
Dim L1 As Bit
Dim L2 As Bit
Dim R1 As Bit
Dim R2 As Bit

Dim up_flag As Bit
Dim down_flag As Bit
Dim right_flag As Bit
Dim left_flag As Bit
Dim selec_flag As Bit
Dim start_flag As Bit
Dim L_stick_flag As Bit
Dim R_stick_flag As Bit
Dim cross_flag As Bit
Dim trian_flag As Bit
Dim round_flag As Bit
Dim squar_flag As Bit
Dim L1_flag As Bit
Dim L2_flag As Bit
Dim R1_flag As Bit
Dim R2_flag As Bit

Dim Co As Byte
Dim Cnt As Byte
Dim Center As Byte
Dim Mini As Byte
Dim Maxi As Byte

Symbol bds = 16572 'inverted 16572 = 4800 true = 84=9600;188=4800;396=2400
Symbol SDA = PORTC.4
Symbol SCL = PORTC.3

'mode:
Symbol mode = 128
Symbol overlay = 0
Symbol full_scr = 1
'position:
Symbol position = 129
'x = 1-28, y = 1-11
'clear screen
Symbol clr_scr = 130
'visible:
Symbol visible = 131
Symbol hide_txt = 0
Symbol show_txt = 1
'translucent
Symbol translucent = 132
Symbol S_off = 0
Symbol S_On = 1
'background color
Symbol backgnd_color = 133
Symbol black = 0
Symbol blue = 1
Symbol green = 2
Symbol cyan = 3
Symbol red = 4
Symbol magenta = 5
Symbol yellow = 6
Symbol white = 7
'zoom
Symbol zoom = 134
'row = 1-11,horizontal = 1-4,vertical = 1-4
'character color
Symbol chr_color = 135
'same as background color
'character blink
Symbol chr_blink = 136
'same as translucent
Symbol reset_osd = 137
'vertical offset
Symbol vert_offset = 138
'1-63
'horizontal offset
Symbol hori_offset = 139
'1-58
Symbol chr_frame = 140
'same as translucent and chr_blink

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
init:
'ALL_DIGITAL true
DelayMS 110

'Include "BUFFERED_HSERIN.INC" ' Load the USART 1 interrupt handler and buffer read subroutines into memory

Symbol lamp_A = PORTD.4
Symbol lamp_B = PORTD.5
Symbol lamp_C = PORTD.6
Symbol lamp_D = PORTD.7
Symbol MIC800_reset = PORTB.6
Symbol RX = PORTC.7
Symbol TX = PORTC.6
Symbol Tx_Rx_Sens = PORTC.5
Symbol S_RS232_Mic800 = PORTD.1
Symbol Bds_Mic800 = 16780
Symbol ELCD = PORTE.2

Symbol bds_ELCD = 32 '19200
Symbol bds_2_ELCD = 8 '34800
Symbol bds_4_ELCD = 84 '9600
Symbol bds_3_ELCD = 188 '4800
Symbol bds_1_ELCD = 396 '2400
Symbol bds_5_ELCD = 813 '1200

Symbol OSD = PORTD.2
Symbol bds_osd = 16572 'inverted 16572 = 4800 true = 84=9600;188=4800;396=2400

Symbol TINYbld = PORTC.6

Low MIC800_reset

PORTA = %00000000
PORTB = %00000000
PORTC = %00000000
PORTD = %00000000
PORTE = %00000000

up_flag = 0
down_flag = 0
right_flag = 0
left_flag = 0
selec_flag = 0
start_flag = 0
L_stick_flag = 0
R_stick_flag = 0
cross_flag = 0
trian_flag = 0
round_flag = 0
squar_flag = 0
L1_flag = 0
L2_flag = 0
R1_flag = 0
R2_flag = 0

''''''''''''''''
'Setup the USART
'
Hserial_Baud = 19200 ' Set baud rate for USART 1
Hserial_RCSTA = %10010000 ' Enable serial port and continuous receive
Hserial_TXSTA = %00100000 ' Enable transmit and asynchronous mode
' HSERIAL_RCSTA=$90
'HSERIAL_TXSTA=$24
'HSERIAL_SPBRG=129 ' 32 ''19200 Bauds
'HSERIAL_CLEAR=On

Dim S As String * 23
Dim CHARPOS As Byte
Dim X As Byte
Low lamp_A
Low lamp_B
Low lamp_C
Low lamp_D
Co = 0
Cnt = 0
SerOut ELCD,bds_ELCD,[$A1,0,0,$A2,"Soft V1.0",$00]
DelayMS 1000
SerOut ELCD,bds_ELCD,[$A3,$01]


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

GoSub osd_init

Setup_ESC:
Center = 64
Mini = 27'25
Maxi = 128
High MIC800_reset
GoSub MIC800_init

DelayMS 200

For Cnt = 0 To 2
GoSub Lamps_Test
Next Cnt



''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
main:


GoSub Receive
GoSub Calibration

SerOut OSD,bds_osd ,[position,1,1,"Controlleur Calibration done"]
SerOut OSD,bds_osd ,[position,1,2,"Sub is ready..."]
DelayMS 3000
SerOut OSD,bds_osd ,[clr_scr]
DelayMS 100


'SerOut ELCD,bds_ELCD,[$A1,0,0,$A2,sDec M_r_l_True_Center,":",sDec M_f_r_True_Center ,$00,$A1,0,1,$A2,sDec M_f_l_True_Center ,":",sDec M_r_r_True_Center," ",Dec psxjoystick_4,$00]
'delayms 10000
Co = 0
Cnt = 0
selec_flag = 0
Low lamp_A
Low lamp_B
Low lamp_C
Low lamp_D



loop:


GoSub Receive
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' mic800 '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'gosub transmit
MIC800:

'ESC centers triggers
'to be sure that motors starts properly put the triggers a little higher
'there is a relationship with the center value

'deadband:
'If 71 > M_f_r And 57 < M_f_r Then M_f_r = Center
'If 71 > M_r_l And 57 < M_r_l Then M_r_l = Center
'If 71 > M_f_l And 57 < M_f_l Then M_f_l = Center
'If 71 > M_r_r And 57 < M_r_r Then M_r_r = Center

'protection
If M_f_r >=128 Then M_f_r = 128
If M_f_r <=1 Then M_f_r = 1
If M_r_l >=128 Then M_r_l = 128
If M_r_l <=1 Then M_r_l = 1
If M_f_l >=128 Then M_f_l = 128
If M_f_l <=1 Then M_f_l = 1
If M_r_r >=128 Then M_r_r = 128
If M_r_r <=1 Then M_r_r = 1

'will it works with MFR and MFL inverted?? yes indeed!!!!!!
SerOut S_RS232_Mic800,Bds_Mic800 ,["S","A",Dec M_f_l,13,"S","B",Dec M_f_r,13,"S","C",Dec M_r_r,13,"S","D",Dec M_r_l,13,"S","E",Dec psxjoystick_4,13,"S","F",Dec psxjoystick_4,13]

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' read batterie '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'to print batterie level
ADC_Test:
Volts = ADIn 0 'battery level
DelayMS 1
'pont diviseur = 16volt *10k
' ------------ = 5v
' 32k
' coef = 16/5 = 3.2
' 0 To 1023 1023/16v=64
'SerOut PORTC.6 , 32 , [Dec2 Volts / 49,"Volts"]

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' read compass '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
angle_16bit:
'0x13
'2,3

' first start bit then module adress with right bit low
'then register number then again start
'and module adress again with read bit high
' I2Cout SDA, SCL, Control, Address, [Var1]
I2Cout SDA, SCL, $C0 , [2] '3
'I2Cin SDA, SCL, Control, Address, [Var1]
I2Cin SDA, SCL, $C1, [heading]

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' print osd '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

If Volts /49 < 10 Then SerOut OSD,bds_osd ,[chr_blink,S_On] :GoSub Lamps_Test: Else : SerOut OSD,bds_osd ,[chr_blink,S_off]: EndIf
SerOut OSD,bds_osd ,[position,1,1,Dec2 Volts / 49,"Volts"]

SerOut OSD,bds_osd ,[position,12,11,Dec4 heading,"Deg"]
SerOut OSD,bds_osd ,[position,15,11," "]

If lamp_D = 1 Then SerOut OSD,bds_osd ,[position,26,2,"L2",31] : Else : SerOut OSD,bds_osd ,[position,26,2,"L2",26] : EndIf
If lamp_C = 1 Then SerOut OSD,bds_osd ,[position,22,2,"L1",31] : Else : SerOut OSD,bds_osd ,[position,22,2,"L1",26] : EndIf
If lamp_B = 1 Then SerOut OSD,bds_osd ,[position,24,3,"L4",31] : Else : SerOut OSD,bds_osd ,[position,24,3,"L4",26] : EndIf
If lamp_A = 1 Then SerOut OSD,bds_osd ,[position,24,1,"L3",31] : Else : SerOut OSD,bds_osd ,[position,24,1,"L3",26] : EndIf




'SerOut ELCD,bds_ELCD,[$A1,0,0,$A2,Dec Cnt,$00]

'SerOut ELCD,bds_ELCD,[$A1,0,0,$A2,Dec3 M_r_l,":",Dec3 M_f_r ,$00,$A1,0,1,$A2,Dec3 M_f_l ,":",Dec3 M_r_r,$00]

'GoSub send_compass




GoTo loop

Stop

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Calibration:
'needs togo to receive subroutine first
M_f_r_Cal = M_f_r
M_r_l_Cal = M_r_l
M_f_l_Cal = M_f_l
M_r_r_Cal = M_r_r

'SerOut ELCD,bds_ELCD,[$A1,0,0,$A2,Dec M_F_l,":",Dec M_f_r ,$00,$A1,0,1,$A2,Dec M_r_l ,":",Dec M_r_r,$00]

M_f_r_True_Center = M_f_r_Cal - Center
M_r_l_True_Center = M_r_l_Cal - Center
M_f_l_True_Center = M_f_l_Cal - Center
M_r_r_True_Center = M_r_r_Cal - Center
'SerOut ELCD,bds_ELCD,[$A1,6,0,$A2,sDec M_f_l_True_Center,":",sDec M_f_r_True_Center ,$00,$A1,6,1,$A2,sDec M_r_l_True_Center ,":",sDec M_r_r_True_Center,$00]
Return
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''



'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
MIC800_init:
For Co = 0 To 2
SerOut S_RS232_Mic800,Bds_Mic800 ,["S","A",Dec Maxi,13,"S","B",Dec Maxi,13,"S","C",Dec Maxi,13,"S","D",Dec Maxi,13,"S","E",Dec Maxi,13,"S","F",Dec Maxi,13]
Next Co
'delayms 2000
For Co = 0 To 2
SerOut S_RS232_Mic800,Bds_Mic800 ,["S","A",Dec Mini,13,"S","B",Dec Mini,13,"S","C",Dec Mini,13,"S","D",Dec Mini,13,"S","E",Dec Mini,13,"S","F",Dec Mini,13]
Next Co
'DelayMS 2000
'For Co = 0 To 2
'SerOut S_RS232_Mic800,Bds_Mic800 ,["S","A",Dec Center,13,"S","B",Dec Center,13,"S","C",Dec Center,13,"S","D",Dec Center,13,"S","E",Dec Center,13,"S","F",Dec Center,13]
'Next Co
DelayMS 3500
Return
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

MIC800_Test:
'don't forget to put 5V to the ESC board
For Co = Center To Mini Step -1
SerOut S_RS232_Mic800,Bds_Mic800 ,["S","A",Dec Co,13,"S","B",Dec Co,13,"S","C",Dec Co,13,"S","D",Dec Co,13,"S","E",Dec Co,13,"S","F",Dec Co,13]
DelayMS 50
SerOut ELCD,bds_ELCD,[$A1,0,1,$A2,Dec Co,$00]
Next Co

For Co = Mini To Center Step 1
SerOut S_RS232_Mic800,Bds_Mic800 ,["S","A",Dec Co,13,"S","B",Dec Co,13,"S","C",Dec Co,13,"S","D",Dec Co,13,"S","E",Dec Co,13,"S","F",Dec Co,13]
DelayMS 50
SerOut ELCD,bds_ELCD,[$A1,0,1,$A2,Dec Co,$00]
Next Co


For Co = Center To Maxi Step 1
SerOut S_RS232_Mic800,Bds_Mic800 ,["S","A",Dec Co,13,"S","B",Dec Co,13,"S","C",Dec Co,13,"S","D",Dec Co,13,"S","E",Dec Co,13,"S","F",Dec Co,13]
DelayMS 50
SerOut ELCD,bds_ELCD,[$A1,0,1,$A2,Dec Co,$00]
Next Co

For Co = Maxi To Center Step -1
SerOut S_RS232_Mic800,Bds_Mic800 ,["S","A",Dec Co,13,"S","B",Dec Co,13,"S","C",Dec Co,13,"S","D",Dec Co,13,"S","E",Dec Co,13,"S","F",Dec Co,13]
DelayMS 50
SerOut ELCD,bds_ELCD,[$A1,0,1,$A2,Dec Co,$00]
Next Co


Return
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' recieve '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Receive:
Low Tx_Rx_Sens 'always receive
'CLEAR_SERIAL_BUFFER ' Clear the serial buffer and reset its pointers
' INIT_USART_INTERRUPT ' Initiate the USART 1 serial buffer interrupt
HSerIn 1000, Timeout,[Wait( "@A" ),S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[8],S[9],S[10],S[11],S[12],S[13],S[14],S[15],S[16],S[17],S[18],S[19],S[20],S[21],S[22],S[23]] ' Read data from the serial bus
Inc Co
'sentence is like that :
'["@","A",sDEC3 M_f_r,"B",sDEC3 M_r_l,"C",sDEC3 M_f_l ,"D",sDEC3 M_r_r,"E",psxjoystick_4,"F",psxbutton_1,"G",psxbutton_2,"*"]
'SerOut ELCD,bds_ELCD,[$A1,0,0,$A2,S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[8],S[9],S[10],S[11],$00]
' SerOut ELCD,bds_ELCD,[$A1,0,1,$A2,S[12],S[13],S[14],S[15],S[16],S[17],S[18],S[19],S[20],S[21],$00]

'0 = A
S[1] = S[1] - 48
S[2] = S[2] - 48
S[3] = S[3] - 48
'4 = B
S[5] = S[5] - 48
S[6] = S[6] - 48
S[7] = S[7] - 48
'8 = C
S[9] = S[9] - 48
S[10] = S[10] - 48
S[11] = S[11] - 48
'12 = D
S[13] = S[13] - 48
S[14] = S[14] - 48
S[15] = S[15] - 48
'16 = E
S[17] = S[17] - 48
S[18] = S[18] - 48
S[19] = S[19] - 48
'20 = F
left = S[21] & %10000000 '%01111111
right = S[21] & %00100000 '%11011111
down = S[21] & %01000000 '%10111111
up = S[21] & %00010000 '%11101111
start = S[21] & %00001000 '%11110111
R_stick = S[21] & %00000100 '%11111011
L_stick = S[21] & %00000010 '%11111101
selec = S[21] & %00000001 '%11111110
'22 = G
squar = S[23] & %10000000 '%01111111
cross = S[23] & %01000000 '%10111111
round = S[23] & %00100000 '%11011111
trian = S[23] & %00010000 '%11101111
R1 = S[23] & %00001000 '%11110111
L1 = S[23] & %00000100 '%11111011
R2 = S[23] & %00000010 '%11111101
L2 = S[23] & %00000001 '%11111110

'convert ASCII chars to decimal numbers
' M_f_r = S[3] + S[2]*10 + S[1]*100
' m_r_l = S[7] + S[6]*10 + S[5]*100
' m_f_l = S[11] + S[10]*10 + S[9]*100
' m_r_r = S[15] + S[14]*10 + S[13]*100
' psxjoystick_4 = S[19] + S[18]*10 + S[17]*100
'convert ASCII chars to decimal numbers
M_f_r = S[1]*100 + S[2]*10 + S[3]
M_r_l = S[5]*100 + S[6]*10 + S[7]
M_f_l = S[9]*100 + S[10]*10 + S[11]
M_r_r = S[13]*100 + S[14]*10 + S[15]
psxjoystick_4 = S[17]*100 + S[18]*10 + S[19]

If round = 0 Then
If Co > 3 Then
Toggle lamp_D
Co = 0
EndIf
EndIf
If squar = 0 Then
If Co > 3 Then
Toggle lamp_C
Co = 0
EndIf
EndIf
If cross = 0 Then
If Co > 3 Then
Toggle lamp_B
Co = 0
EndIf
' Co = 0
'EndIf
EndIf
If trian = 0 Then
'If Co > 3 Then
If Co > 3 Then
Toggle lamp_A
Co = 0
EndIf
EndIf
'TRIM DEEPTH
'Co = 0
If R1 = 0 Then
'If Co > 3 Then
If Co > 1 Then
Cnt = Cnt - 1
Co = 0
EndIf
EndIf
If R2 = 0 Then
'If Co > 3 Then
If Co > 1 Then
Cnt=Cnt + 1
Co = 0
EndIf
EndIf

' If start = 0 Then
' 'If Co > 3 Then
' If Co > 3 Then
' Cnt = 0
' Co = 0
' EndIf
'EndIf
If selec = 0 Then
'If Co > 3 Then
If Co > 3 Then
Cnt = 0
selec_flag = selec_flag + 1 'XOR so it is like toggle function
Toggle lamp_A
Toggle lamp_B
Toggle lamp_C
Toggle lamp_D
DelayMS 100
Toggle lamp_A
Toggle lamp_B
Toggle lamp_C
Toggle lamp_D

Co = 0
EndIf
EndIf

'If selec_flag = 1 Then psxjoystick_4 = Center + Cnt : Else : Cnt = 0: psxjoystick_4 = psxjoystick_4 : EndIf
If selec_flag = 1 Then psxjoystick_4 = Center + Cnt : Else : psxjoystick_4 = psxjoystick_4 + Cnt : EndIf

Clear S 'erase the whole sentence and start over

'SerOut ELCD,bds_ELCD,[$A1,0,1,$A2,Bin1 round,",",Bin1 down,",",Bin1 right,",",Bin1 left,",",Bin1 start,$00]
' SerOut ELCD,bds_ELCD,[$A1,0,1,$A2,dec M_f_r,",",dec M_r_l,",", dec M_f_l,",",dec M_r_r,$00]
'SerOut ELCD,bds_ELCD,[$A1,0,0,$A2,S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[8],S[9],S[10],S[11],$00]
Return
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Lamps_Test:

High lamp_A
High lamp_B
High lamp_C
High lamp_D
'If lamp_D = 1 Then SerOut OSD,bds ,[position,18,5,31] : Else : SerOut OSD,bds ,[position,18,5,26] : EndIf
'If lamp_C = 1 Then SerOut OSD,bds ,[position,22,5,31] : Else : SerOut OSD,bds ,[position,22,5,26] : EndIf
'If lamp_b = 1 Then SerOut OSD,bds ,[position,18,7,31] : Else : SerOut OSD,bds ,[position,18,7,26] : EndIf
'If lamp_A = 1 Then SerOut OSD,bds ,[position,22,7,31] : Else : SerOut OSD,bds ,[position,22,7,26] : EndIf

DelayMS 500

Low lamp_A
Low lamp_B
Low lamp_C
Low lamp_D
'If lamp_D = 1 Then SerOut OSD,bds ,[position,18,5,31] : Else : SerOut OSD,bds ,[position,18,5,26] : EndIf
'If lamp_C = 1 Then SerOut OSD,bds ,[position,22,5,31] : Else : SerOut OSD,bds ,[position,22,5,26] : EndIf
'If lamp_b = 1 Then SerOut OSD,bds ,[position,18,7,31] : Else : SerOut OSD,bds ,[position,18,7,26] : EndIf
'If lamp_a = 1 Then SerOut OSD,bds ,[position,22,7,31] : Else : SerOut OSD,bds ,[position,22,7,26] : EndIf
DelayMS 200
'PWM lamp_A , 130,100
'PWM lamp_B , 130,100
'PWM lamp_C , 130,100
'PWM lamp_D , 130,100
'delayms 2000
'PWM lamp_A , 255,100
'PWM lamp_B , 255,100
'PWM lamp_C , 255,100
'PWM lamp_D , 255,100
'delayms 2000
Return

osd_init:
SerOut OSD,bds ,[mode,overlay]'overlay full_scr]
SerOut OSD,bds ,[visible,hide_txt]
SerOut OSD,bds ,[clr_scr]
DelayMS 10

SerOut OSD,bds ,[visible,show_txt]
SerOut OSD,bds ,[translucent,S_off]
SerOut OSD,bds ,[chr_frame,S_off]

SerOut OSD,bds ,[position,1,1,"Sub is powering up"]


Return



Timeout:
'set motor off in case of link failure
M_f_r = Center
M_r_l = Center
M_f_l = Center
M_r_r = Center
psxjoystick_4 = Center
'then flash light so sub can be found
GoSub Lamps_Test
GoSub MIC800
'will it works with MFR and MFL inverted?? yes indeed!!!!!!
'SerOut S_RS232_Mic800,Bds_Mic800 ,["S","A",Dec M_f_l,13,"S","B",Dec M_f_r,13,"S","C",Dec M_r_r,13,"S","D",Dec M_r_l,13,"S","E",Dec psxjoystick_4,13,"S","F",Dec psxjoystick_4,13]




Stop
'set motors to 0
'flash light
'goback to serin retry to connect the device

End
fefenin (exploboticien!)

retrouvez les infos locales de figeac sur :
http://www.telefigeac.com

GBDF1
Messages : 40
Inscription : Sam Mai 28, 2011 7:09 am

Re: le ROV de fefe ; evolution du projet.

Messagepar GBDF1 » Sam Nov 26, 2011 11:08 am

salut fefenin,

merci pour toutes ses infos c'est cool d'avoir un autre modele de rov complet pour pouvoir en apprendre plus sur les differentes approche electronique et logiciel je pense que ton poste sera apprecié par les futur "EXPLOBOTICIEN".
des que mon rov commencera a etre developper je communiquerai evidament toutes mes info mais je pense qu'il n'y aura pas de nouveau par rapport a vos creation.

merci

gael

Avatar de l’utilisateur
fefenin
Messages : 196
Inscription : Mer Déc 05, 2007 7:32 pm
Localisation : Figeac,lot (46)

Re: le ROV de fefe ; evolution du projet.

Messagepar fefenin » Sam Nov 26, 2011 11:25 am

de rien!

autant que ca serve...
fefenin (exploboticien!)

retrouvez les infos locales de figeac sur :
http://www.telefigeac.com


Revenir vers « Vos projets »

Qui est en ligne ?

Utilisateurs parcourant ce forum : Aucun utilisateur inscrit et 4 invités