FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC

Développement d'applications avec le langage Panoramic
 
AccueilAccueil  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  MembresMembres  Connexion  
Derniers sujets
» Editeur EliP 6 : Le Tiny éditeur avec 25 onglets de travail
robotique et Panoramic - Page 3 Emptypar papydall Aujourd'hui à 16:57

» PANORAMIC V 1
robotique et Panoramic - Page 3 Emptypar papydall Aujourd'hui à 3:22

» select intégrés [résolu]
robotique et Panoramic - Page 3 Emptypar jjn4 Hier à 17:00

» number_mouse_up
robotique et Panoramic - Page 3 Emptypar jjn4 Hier à 11:59

» Aide de PANORAMIC
robotique et Panoramic - Page 3 Emptypar jjn4 Hier à 11:16

» trop de fichiers en cours
robotique et Panoramic - Page 3 Emptypar lepetitmarocain Hier à 10:43

» Je teste PANORAMIC V 1 beta 1
robotique et Panoramic - Page 3 Emptypar papydall Hier à 4:17

» bouton dans autre form que 0
robotique et Panoramic - Page 3 Emptypar leclode Lun 6 Mai 2024 - 13:59

» KGF_dll - nouvelles versions
robotique et Panoramic - Page 3 Emptypar Klaus Lun 6 Mai 2024 - 11:41

» Gestion d'un système client-serveur.
robotique et Panoramic - Page 3 Emptypar Klaus Lun 6 Mai 2024 - 10:23

» @Jack
robotique et Panoramic - Page 3 Emptypar Jack Mar 30 Avr 2024 - 20:40

» Une calculatrice en une ligne de programme
robotique et Panoramic - Page 3 Emptypar jean_debord Dim 28 Avr 2024 - 8:47

» Form(résolu)
robotique et Panoramic - Page 3 Emptypar leclode Sam 27 Avr 2024 - 17:59

» Bataille navale SM
robotique et Panoramic - Page 3 Emptypar jjn4 Ven 26 Avr 2024 - 17:39

» Les maths du crocodile
robotique et Panoramic - Page 3 Emptypar jean_debord Jeu 25 Avr 2024 - 10:37

Navigation
 Portail
 Index
 Membres
 Profil
 FAQ
 Rechercher
Rechercher
 
 

Résultats par :
 
Rechercher Recherche avancée
Mai 2024
LunMarMerJeuVenSamDim
  12345
6789101112
13141516171819
20212223242526
2728293031  
CalendrierCalendrier
Le Deal du moment : -21%
LEGO® Icons 10329 Les Plantes Miniatures, ...
Voir le deal
39.59 €

 

 robotique et Panoramic

Aller en bas 
+5
Jicehel
Yannick
Mumu
Klaus
mindstorm
9 participants
Aller à la page : Précédent  1, 2, 3, 4, 5  Suivant
AuteurMessage
Invité
Invité




robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyMer 3 Avr 2013 - 14:18

Bonjour.
Si c'est une question de longeur de programme, effectivement il y a les incudes.
Mais il y a aussi une autre méthode et les deux peuvent se compléter.
Pour un grand programme je me sert de diff"rents onglets pour faire le code.
Un pour l'assemblage des onglets.
Un pour les dims
Un pour les labels
Un pour le gui.
Et ensuite selon le cas, un onglet général, où je rassemble les parties des codes finis, et un ou plusieurs pour la procédure ou sous-programme en cours.
Ainsi, chaque fois que je veux une nouvelle variable, ou label, je clique sur l'onglet concerné, pour ajouter, ou voir l’existence d'un dim ou label, et reprend ensuite mon onglet de travail, où je me trouve directement à l'emplacement où j'en étais resté. Cela permet aussi de voir d'autre partie de code pour être en osmose avec ce qu'on écrit, et revenir automatiquement à son onglet, et là où on était resté.

Panoramic n'ait pas trop pratique à cause de la sauvegarde qui ne peut se faire que sur le clic d'un icône, et des validations. Pourtant ce serait simple à faire le raccourcis pour sauvegarder par Ctrl S. J'utilise PsPad qui pour cette façon de procédé est plus pratique, et même maintenant xED qui permet de sauvegarder des images à l'intérieur du code, et parfois de mieux comprendre ce qu'on fait, ou se que l'on veut faire. J'en ai déjà parlé, mais cela ne semble pas être intéressant pour beaucoup. Ce que je conçois sans problème.
Si la solution de multi onglets te conviens, alors on peut en reparler. Dans le cas contraire je me retire.
Salutation.
Revenir en haut Aller en bas
Yannick




Nombre de messages : 8610
Age : 53
Localisation : Bretagne
Date d'inscription : 15/02/2010

robotique et Panoramic - Page 3 Empty
MessageSujet: re   robotique et Panoramic - Page 3 EmptyMer 3 Avr 2013 - 15:37

@ Cosmos70,

C'est un peu comme cela que je procede...
Chaque fichier est ouvert dans un onglet différent pour aller plus vite
quand je recherche quelque chose et je lie les fichiers au main par include.
Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyMer 3 Avr 2013 - 21:59

bonsoir a tous
merci pour votre soutient
je suis partant pour les onglets mais je ne les vois pas sous panoramic?
si je comprends bien vous pouvez editer le programme dans un editeur de text lambda et le joindre a panoramic ulterieurement.
j'ai tenté cela il y a 30 ans en C+ mais je ne suis pas assé sur de moi pour ecrire de longues sequances sans controle par execute (F9) periodique.
de là une belle perte de temps!!!!
chacun fait selon ces moyens Sad
je file regarder les include en attendant
a bientôt
Mindstorm
Revenir en haut Aller en bas
Invité
Invité




robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyJeu 4 Avr 2013 - 0:05

Pour travailler avec des onglets.
Spoiler:

Voila beaucoup de choses et je condense.
Comme on dit: la suite au prochain numéro, si il y a des demandes.
Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyJeu 4 Avr 2013 - 20:49

super mais hard
il va falloir que je digere
merci
Mindstorm
Revenir en haut Aller en bas
Invité
Invité




robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyJeu 4 Avr 2013 - 21:18

Faut-il que je fasse le programme d'assemblage?
Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyJeu 4 Avr 2013 - 21:34

Wink
merci je vais essayer tout seul , j'apprends mieux, mais je ne doute pas avoir des problemes.
cela dit, cela peut servir a pas mal de monde car les BUGS au demarrage ne sont pas folichons Evil or Very Mad
pour l'instant il faut vraiment que je trouve une astuce pour avancer en automatique de façon fluide de bloc en bloc pour faire vrai.
une idée me vient, est il possible, sous panoramic, de generer une surface en 3D pour rouler dessus et eventuelement creuser (mon fils a plein de bonnes idées). je pense a un empilement de briques qui s'effacent au touché du godet, il me faudrai surement un tableau trois entrées ou x tableaux 2D
bonsoir a tous
Mindstorm
Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: merci de votre indulgence   robotique et Panoramic - Page 3 EmptyLun 8 Avr 2013 - 21:58

bonsoir a tous
vous pouvez deja programmer la minipelle mais le programme n'est pas abouti
je cherche une solution pour ecrire le programme par blocs preecrit
peut etre avec le fichier texte Suspect
Code:
 
dim touche_d,touche_e,touche_g,touche_h,touche_k,touche_l,touche_m,touche_o,touche_q,touche_s,touche_t,touche_y,
dim touche_echap,touche_retour,touche_enter,touche_espace,touche_haut,touche_bas
dim x2,x6,z2,z6,yr6,x3,y3,i
dim moteur, son2 ,son7 ,ok
dim t,r,tou,cr,vi,te,s

label manuel , vue ,quit,prog ,minipelle,initm,initauto,dumper,programme
label bibliotheque_touche_1 , bibliotheque_touche_2
label translation,rotation,tourne,creuse,vide,test
moteur=0 : ok=0
scene3d 99
full_space 0 :  full_space 99  : border_hide 0
color 99,0,0,200

3D_SKYBOX 3
3D_LOAD_TEXTURE_TOP 3,"skybox_top.jpg"
3D_LOAD_TEXTURE_LEFT 3,"bskybox_left.jpg"
3D_LOAD_TEXTURE_BACK 3,"bskybox_back.jpg"
3D_LOAD_TEXTURE_FRONT 3,"bskybox_front.jpg"
3D_LOAD_TEXTURE_RIGHT 3,"bskybox_right.jpg"

fog_on
fog_distance_min 5
fog_distance_max 700
fog_color 219,243,165

3d_plane 4
3d_scale 4,50,50,50
3d_x_rotate 4,90
3d_y_position 4,0
3d_load_texture 4,"herbe2.JPG"
3d_u_tile 4,400
3d_v_tile 4,400


3d_plane 14
3d_scale 14,5,5,1
3d_x_rotate 14,90
3d_y_position 14,0.02
3d_load_texture 14,"herbe1.JPG"

3d_cube 1,1:3d_position 1,35,6,0
3d_cube 2,2 :3d_position 2,-20,0,0

light_position -99,90,130
gosub vue

form 200
caption 200,"poste de commande"
command_target_is 200
button 100 : top 100,30 : left 100,10 : caption 100,"mode manuel" : on_click 100,initm
button 101 : top 101,5 : left 101,10 :caption 101,"lancement prog": on_click 101,initauto
button 102 : top 102,100 : left 102,10 : caption 102,"QUITTER" : on_click 102,quit
button 103 : top 103,150 : left 103,10 : caption 103,"minipelle" : on_click 103,minipelle
button 104 : top 104,125 : left 104,10 : caption 104,"dumper" : on_click 104,dumper
button 105 : top 105,55 : left 105,10 : caption 105,"creation prog" : on_click 105,programme

end

'initialisation manu
initm:
command_target_is 0
on_key_down 0,bibliotheque_touche_1
on_key_up 0,bibliotheque_touche_2
timer 1 : timer_interval 1,1 : on_timer 1,manuel
end

'initialisation auto
initauto:
command_target_is 0
hide 200
gosub prog
show 200
command_target_is 200

return

programme:

return

prog:

tou=270 : s=1
gosub tourne
 for i=1 to 50
 x3=i/200
  3d_move 5,x3
  pause 10
 next i
 gosub vue

return


' creation du robot dumper
dumper:
3d_mesh 20
3d_load_object 20,"dumper.3ds"
3d_color 20,250,150,0
3d_position 20,0,1.1,20
3d_x_rotate 20,180
3d_scale 20,1.7,1.3,1.5


return

' creation du robot minipelle
minipelle:
3d_mesh 5
3d_load_object 5,"chaine.3ds"
3d_color 5,133,107,34


3d_mesh 6
3d_load_object 6,"chassi.3ds"
3d_chain 6,5
3d_color 6,250,150,0

3d_mesh 7
3d_load_object 7,"vitre.3ds"
3d_chain 7,6
3d_color 7,76,98,112

3d_mesh 8
3d_load_object 8,"bras1.3ds"
3d_chain 8,7
3d_color 8,250,150,0
3d_position 8,0,1.2,1.3

3d_mesh 9
3d_load_object 9,"bras2.3ds"
3d_chain 9,8
3d_color 9,250,150,0
3d_position 9,0,1.7,2

3d_mesh 10
3d_load_object 10,"godet.3ds"
3d_chain 10,9
3d_color 10,86,76,47
3d_position 10,0,-1.1,0.9

3d_mesh 11
3d_load_object 11,"lame.3ds"
3d_chain 11,5
3d_color 11,86,76,47
3d_position 11,0,0.5,1

3d_position 5,0,0,3
3d_y_rotate 5,140

gosub vue

rem sound 2 : file_load 2,"moteur.wav"
sound 7 : file_load 7,"klaxon.wav"

return

' utilisation direct des robots
manuel:
hide 200
if touche_enter = 1
  if ok = 0
    if moteur=0
      moteur=1
      else
      moteur=0
    rem  delete 2
    rem  sound 2 : file_load 2,"moteur.wav"
    end_if
  end_if
  ok=1
  else
  ok=0
end_if

if moteur=1
rem  play 2
  if touche_t+ touche_y=2 then 3d_move 5,0.03
  if touche_g=1 and touche_h=1 then 3d_move 5,(-0.03)
  if touche_t=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.4
  if touche_h=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.4
  if touche_y=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.4
  if touche_g=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.4
  if touche_q = 1 then 3d_y_rotate 6,o3d_y_rotate(6)+0.5
  if touche_d = 1 then 3d_y_rotate 6,o3d_y_rotate(6)-0.5
  if touche_e = 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
  if touche_s = 1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.7
  if touche_l = 1 and o3d_x_rotate(8) > -70 then 3d_x_rotate 8,o3d_x_rotate(8)-0.3
  if touche_o = 1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
  if touche_k = 1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
  if touche_m = 1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.7
  if touche_bas = 1 and o3d_x_rotate(11) > -5 then 3d_x_rotate 11,o3d_x_rotate(11)-0.13
  if touche_haut = 1 and o3d_x_rotate(11) < 8 then 3d_x_rotate 11,o3d_x_rotate(11)+0.13
end_if

if touche_espace = 1
  play 7
end_if
touche_espace = 0

if touche_echap = 1
gosub quit
 rem TIMER_OFF_ALL
rem  delete 2
 rem delete 7
 rem 3d_chain_break 6,5
 rem 3d_chain_break 7,6
 rem 3d_chain_break 8,7
 rem 3d_chain_break 9,8
 rem 3d_chain_break 10,9
 rem 3d_chain_break 11,5
 rem terminate
end_if

gosub vue
return

'camera
vue:
cam_position o3d_x_position(1),o3d_y_position(1),o3d_z_position(1)
point_position o3d_x_position(2),o3d_y_position(2),o3d_z_position(2)
return

bibliotheque_touche_1:
if key_down_code = 68 then touche_d=1
if key_down_code = 69 then touche_e=1
if key_down_code = 71 then touche_g=1
if key_down_code = 72 then touche_h=1
if key_down_code = 75 then touche_k=1
if key_down_code = 76 then touche_l=1
if key_down_code = 77 then touche_m=1
if key_down_code = 79 then touche_o=1
if key_down_code = 81 then touche_q=1
if key_down_code = 83 then touche_s=1
if key_down_code = 84 then touche_t=1
if key_down_code = 89 then touche_y=1
if key_down_code = 27 then touche_echap=1
if key_down_code = 8 then touche_retour=1
if key_down_code = 13 then touche_enter=1
if key_down_code = 32 then touche_espace=1
if key_down_code = 38 then touche_haut=1
if key_down_code = 40 then touche_bas=1
return

bibliotheque_touche_2:
if key_up_code = 68 then touche_d=0
if key_up_code = 69 then touche_e=0
if key_up_code = 71 then touche_g=0
if key_up_code = 72 then touche_h=0
if key_up_code = 75 then touche_k=0
if key_up_code = 76 then touche_l=0
if key_up_code = 77 then touche_m=0
if key_up_code = 79 then touche_o=0
if key_up_code = 81 then touche_q=0
if key_up_code = 83 then touche_s=0
if key_up_code = 84 then touche_t=0
if key_up_code = 89 then touche_y=0
if key_up_code = 27 then touche_echap=0
if key_up_code = 8 then touche_retour=0
if key_up_code = 13 then touche_enter=0
if key_up_code = 38 then touche_haut=0
if key_up_code = 40 then touche_bas=0
return

translation:
for i=1 to t
3d_move 5,s*(0.03 )
pause 10
next i
return

rotation:
for i=1 to r
3d_y_rotate 5,o3d_y_rotate (5)+ s*(0.4)
pause 10
next i
return

tourne:
for i=1 to tou
3d_y_rotate 6,o3d_y_rotate (6)+(s*(0.5))
pause 10
next i
return

creuse:
if touche_e = 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
 rem if touche_s = 1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.7
 rem if touche_l = 1 and o3d_x_rotate(8) > -70 then 3d_x_rotate 8,o3d_x_rotate(8)-0.3
 rem if touche_o = 1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
 rem if touche_k = 1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
 rem if touche_m = 1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.7
return
vide:
if touche_e = 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
 rem if touche_s = 1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.7
 rem if touche_l = 1 and o3d_x_rotate(8) > -70 then 3d_x_rotate 8,o3d_x_rotate(8)-0.3
 rem if touche_o = 1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
 rem if touche_k = 1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
 rem if touche_m = 1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.7
return
test:

return

quit:
TIMER_OFF_ALL
rem  delete 2
  delete 7
  3d_chain_break 6,5
  3d_chain_break 7,6
  3d_chain_break 8,7
  3d_chain_break 9,8
  3d_chain_break 10,9
  3d_chain_break 11,5
terminate
return

bonne soirée afro
Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyMer 10 Avr 2013 - 0:35

bonsoir a tous
une preversion avec un petit programme exemple
Code:
dim touche_d,touche_e,touche_g,touche_h,touche_k,touche_l,touche_m,touche_o,touche_q,touche_s,touche_t,touche_y,
dim touche_echap,touche_retour,touche_enter,touche_espace,touche_haut,touche_bas
dim x2,x6,z2,z6,yr6,x3,y3,i
dim moteur, son2 ,son7 ,ok
dim t,r,tou,cr,vi,te,s

label manuel , vue ,quit,prog ,minipelle,initm,initauto,dumper,programme
label bibliotheque_touche_1 , bibliotheque_touche_2
label translation,rotation,tourne,creuse,vide,test,init
moteur=0 : ok=0
scene3d 99
full_space 0 :  full_space 99  : border_hide 0
color 99,0,0,200

3D_SKYBOX 3
3D_LOAD_TEXTURE_TOP 3,"skybox_top.jpg"
3D_LOAD_TEXTURE_LEFT 3,"bskybox_left.jpg"
3D_LOAD_TEXTURE_BACK 3,"bskybox_back.jpg"
3D_LOAD_TEXTURE_FRONT 3,"bskybox_front.jpg"
3D_LOAD_TEXTURE_RIGHT 3,"bskybox_right.jpg"

fog_on
fog_distance_min 5
fog_distance_max 700
fog_color 219,243,165

3d_plane 4
3d_scale 4,50,50,50
3d_x_rotate 4,90
3d_y_position 4,0
3d_load_texture 4,"herbe2.JPG"
3d_u_tile 4,400
3d_v_tile 4,400


3d_plane 14
3d_scale 14,5,5,1
3d_x_rotate 14,90
3d_y_position 14,0.02
3d_load_texture 14,"herbe1.JPG"

3d_cube 1,1:3d_position 1,35,6,0
3d_cube 2,2 :3d_position 2,-20,0,0

light_position -99,90,130
gosub vue

form 200
caption 200,"poste de commande"
command_target_is 200
button 100 : top 100,30 : left 100,10 : caption 100,"mode manuel" : on_click 100,initm
button 101 : top 101,5 : left 101,10 :caption 101,"lancement prog": on_click 101,initauto
button 102 : top 102,100 : left 102,10 : caption 102,"QUITTER" : on_click 102,quit
button 103 : top 103,150 : left 103,10 : caption 103,"minipelle" : on_click 103,minipelle
button 104 : top 104,125 : left 104,10 : caption 104,"dumper" : on_click 104,dumper
button 105 : top 105,55 : left 105,10 : caption 105,"creation prog" : on_click 105,programme

end

'initialisation manu
initm:
command_target_is 0
on_key_down 0,bibliotheque_touche_1
on_key_up 0,bibliotheque_touche_2
timer 1 : timer_interval 1,1 : on_timer 1,manuel
end

'initialisation auto
initauto:
command_target_is 0
hide 200
gosub prog
show 200
command_target_is 200

return

programme:

return

prog:
gosub init
 gosub creuse:gosub vide:t=20:s=-1:gosub translation:gosub vue
 gosub creuse:gosub vide:t=20:s=-1:gosub translation:gosub vue
 gosub creuse:gosub vide:t=20:s=-1:gosub translation:gosub vue

return


' creation du robot dumper
dumper:
3d_mesh 20
3d_load_object 20,"dumper.3ds"
3d_color 20,250,150,0
3d_position 20,0,1.1,20
3d_x_rotate 20,180
3d_scale 20,1.7,1.3,1.5


return

' creation du robot minipelle
minipelle:
3d_mesh 5
3d_load_object 5,"chaine.3ds"
3d_color 5,133,107,34


3d_mesh 6
3d_load_object 6,"chassi.3ds"
3d_chain 6,5
3d_color 6,250,150,0

3d_mesh 7
3d_load_object 7,"vitre.3ds"
3d_chain 7,6
3d_color 7,76,98,112

3d_mesh 8
3d_load_object 8,"bras1.3ds"
3d_chain 8,7
3d_color 8,250,150,0
3d_position 8,0,1.2,1.3

3d_mesh 9
3d_load_object 9,"bras2.3ds"
3d_chain 9,8
3d_color 9,250,150,0
3d_position 9,0,1.7,2

3d_mesh 10
3d_load_object 10,"godet.3ds"
3d_chain 10,9
3d_color 10,86,76,47
3d_position 10,0,-1.1,0.9

3d_mesh 11
3d_load_object 11,"lame.3ds"
3d_chain 11,5
3d_color 11,86,76,47
3d_position 11,0,0.5,1

3d_position 5,0,0,3
3d_y_rotate 5,140

gosub vue

rem sound 2 : file_load 2,"moteur.wav"
sound 7 : file_load 7,"klaxon.wav"

return

' utilisation direct des robots
manuel:
hide 200
if touche_enter = 1
  if ok = 0
    if moteur=0
      moteur=1
      else
      moteur=0
    rem  delete 2
    rem  sound 2 : file_load 2,"moteur.wav"
    end_if
  end_if
  ok=1
  else
  ok=0
end_if

if moteur=1
rem  play 2
  if touche_t+ touche_y=2 then 3d_move 5,0.03
  if touche_g=1 and touche_h=1 then 3d_move 5,(-0.03)
  if touche_t=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.4
  if touche_h=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.4
  if touche_y=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.4
  if touche_g=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.4
  if touche_q = 1 then 3d_y_rotate 6,o3d_y_rotate(6)+0.5
  if touche_d = 1 then 3d_y_rotate 6,o3d_y_rotate(6)-0.5
  if touche_e = 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
  if touche_s = 1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.7
  if touche_l = 1 and o3d_x_rotate(8) > -70 then 3d_x_rotate 8,o3d_x_rotate(8)-0.3
  if touche_o = 1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
  if touche_k = 1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
  if touche_m = 1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.7
  if touche_bas = 1 and o3d_x_rotate(11) > -5 then 3d_x_rotate 11,o3d_x_rotate(11)-0.13
  if touche_haut = 1 and o3d_x_rotate(11) < 8 then 3d_x_rotate 11,o3d_x_rotate(11)+0.13
end_if

if touche_espace = 1
  play 7
end_if
touche_espace = 0

if touche_echap = 1
gosub quit
 rem TIMER_OFF_ALL
rem  delete 2
 rem delete 7
 rem 3d_chain_break 6,5
 rem 3d_chain_break 7,6
 rem 3d_chain_break 8,7
 rem 3d_chain_break 9,8
 rem 3d_chain_break 10,9
 rem 3d_chain_break 11,5
 rem terminate
end_if

gosub vue
return

'camera
vue:
cam_position o3d_x_position(1),o3d_y_position(1),o3d_z_position(1)
point_position o3d_x_position(2),o3d_y_position(2),o3d_z_position(2)
return

bibliotheque_touche_1:
if key_down_code = 68 then touche_d=1
if key_down_code = 69 then touche_e=1
if key_down_code = 71 then touche_g=1
if key_down_code = 72 then touche_h=1
if key_down_code = 75 then touche_k=1
if key_down_code = 76 then touche_l=1
if key_down_code = 77 then touche_m=1
if key_down_code = 79 then touche_o=1
if key_down_code = 81 then touche_q=1
if key_down_code = 83 then touche_s=1
if key_down_code = 84 then touche_t=1
if key_down_code = 89 then touche_y=1
if key_down_code = 27 then touche_echap=1
if key_down_code = 8 then touche_retour=1
if key_down_code = 13 then touche_enter=1
if key_down_code = 32 then touche_espace=1
if key_down_code = 38 then touche_haut=1
if key_down_code = 40 then touche_bas=1
return

bibliotheque_touche_2:
if key_up_code = 68 then touche_d=0
if key_up_code = 69 then touche_e=0
if key_up_code = 71 then touche_g=0
if key_up_code = 72 then touche_h=0
if key_up_code = 75 then touche_k=0
if key_up_code = 76 then touche_l=0
if key_up_code = 77 then touche_m=0
if key_up_code = 79 then touche_o=0
if key_up_code = 81 then touche_q=0
if key_up_code = 83 then touche_s=0
if key_up_code = 84 then touche_t=0
if key_up_code = 89 then touche_y=0
if key_up_code = 27 then touche_echap=0
if key_up_code = 8 then touche_retour=0
if key_up_code = 13 then touche_enter=0
if key_up_code = 38 then touche_haut=0
if key_up_code = 40 then touche_bas=0
return

init:
for i=1 to 250
if i>1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
if i>1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.7
if i>1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
pause 4
next i

return

translation:
for i=1 to t
3d_move 5,s*(0.03 )
pause 10
next i
return

rotation:
for i=1 to r
3d_y_rotate 5,o3d_y_rotate (5)+ s*(0.4)
pause 10
next i
return

tourne:
for i=1 to tou
3d_y_rotate 6,o3d_y_rotate (6)+(s*(0.5))
pause 10
next i
return
'creuse au sol a partir de la position init
creuse:
for i=1 to 300
 if i> 1 and o3d_x_rotate(8) > -40 then 3d_x_rotate 8,o3d_x_rotate(8)-0.3
 if i> 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
 if i>1 and o3d_x_rotate(10) < 10 then 3d_x_rotate 10,o3d_x_rotate(10)+0.7
 pause 5
next i
for i=1 to 50
 if i> 1 and o3d_x_rotate(8) > -50 then 3d_x_rotate 8,o3d_x_rotate(8)-0.3
 pause 5
next i
for i=1 to 50
if i> 1 and o3d_x_rotate(10) > -20 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
pause 5
next i
for i=1 to 200
if i> 1 and o3d_x_rotate(8) < -10 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
if i> 1 and o3d_x_rotate(9) > -10 then 3d_x_rotate 9,o3d_x_rotate(9)-0.7
if i>1 and o3d_x_rotate(10) > -90 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
pause 5
next i
return
'vide le godet en hauteur
vide:
for i=1 to 100
if i> 1 and o3d_x_rotate(8) < 20 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
if i> 1 and o3d_x_rotate(9) < 20 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
if i>1 and o3d_x_rotate(10) > -110 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
pause 5
next i
tou=180 : s=-1
gosub tourne
for i=1 to 200
if i> 1 and o3d_x_rotate(9) < 50 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
if i>1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.7
pause 5
next i
tou=180 : s=1
gosub tourne


return
test:

return

quit:
TIMER_OFF_ALL
rem  delete 2
  delete 7
  3d_chain_break 6,5
  3d_chain_break 7,6
  3d_chain_break 8,7
  3d_chain_break 9,8
  3d_chain_break 10,9
  3d_chain_break 11,5
terminate
return
merci de me dire si je vais dans la bonne direction
mindstorm
Revenir en haut Aller en bas
Yannick




Nombre de messages : 8610
Age : 53
Localisation : Bretagne
Date d'inscription : 15/02/2010

robotique et Panoramic - Page 3 Empty
MessageSujet: re   robotique et Panoramic - Page 3 EmptyMer 10 Avr 2013 - 17:48

Tu devrais mettre le dessin du joystick en bas à droite avec les touches et leurs fonctions... scratch
Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyMer 17 Avr 2013 - 22:09

bonsoir a tous
je vous livre une version plus intuitive
si quelqu un peut m'aider , je ne parviens pas a retourner en mode manuel une deuxieme fois




Code:
dim touche_d,touche_e,touche_g,touche_h,touche_k,touche_l,touche_m,touche_o,touche_q,touche_s,touche_t,touche_y,
dim touche_echap,touche_retour,touche_enter,touche_espace,touche_haut,touche_bas
dim x2,x6,z2,z6,yr6,x3,y3,i
dim moteur, son2 ,son7 ,ok
dim t,r,tou,cr,vi,te,s,n

label manuel , vue ,quit,prog ,minipelle,initm,initauto,dumper,programme
label bibliotheque_touche_1 , bibliotheque_touche_2
label translation,rotation,tourne,creuse,vide,test,init
moteur=0 : ok=0
scene3d 99
full_space 0 :  full_space 99  : border_hide 0
color 99,0,0,200

3D_SKYBOX 3
3D_LOAD_TEXTURE_TOP 3,"skybox_top.jpg"
3D_LOAD_TEXTURE_LEFT 3,"bskybox_left.jpg"
3D_LOAD_TEXTURE_BACK 3,"bskybox_back.jpg"
3D_LOAD_TEXTURE_FRONT 3,"bskybox_front.jpg"
3D_LOAD_TEXTURE_RIGHT 3,"bskybox_right.jpg"

fog_on
fog_distance_min 5
fog_distance_max 700
fog_color 219,243,165

3d_plane 4
3d_scale 4,50,50,50
3d_x_rotate 4,90
3d_y_position 4,0
3d_load_texture 4,"herbe2.JPG"
3d_u_tile 4,400
3d_v_tile 4,400


3d_plane 14
3d_scale 14,5,5,1
3d_x_rotate 14,90
3d_y_position 14,0.02
3d_load_texture 14,"herbe1.JPG"

3d_cube 1,1:3d_position 1,35,6,0
3d_cube 2,2 :3d_position 2,-20,0,0

light_position -99,90,130
gosub vue

gosub minipelle
command_target_is 0



form 200 :left 200,700
caption 200,"poste de commande"
command_target_is 200
button 100 : top 100,100 : left 100,10 : caption 100,"mode manuel" : on_click 100,initm
button 101 : top 101,125 : left 101,10 :caption 101,"lancement prog": on_click 101,initauto
button 102 : top 102,150 : left 102,10 : caption 102,"QUITTER" : on_click 102,quit
alpha 103 : top 103, 20 : left 103,10 : caption 103, "positionner votre pelle en manuel et lancez le programme"

form 300
 caption 300,"poste de pilotage"
 command_target_is 300
 alpha 301:left 301,100: top 301,150
 caption 301,"    E      TY      O"
 alpha 302:left 302,100: top 302,168
 caption 302,"  QSD  GH    KLM"
 alpha 303:left 303,10: top 303,118
 caption 303,"-- en mode manuel      stop= esc -- "

timer 1 : timer_interval 1,1

end


'initialisation manu
initm:
on_key_down 0,bibliotheque_touche_1
on_key_up 0,bibliotheque_touche_2
moteur=1 :ok=1
on_timer 1,manuel
return

'initialisation auto
initauto:
hide 200
hide 300
gosub prog
show 200:command_target_is 200
return

'creation du programme
programme:

return

'exemple de programme a executer
prog:
gosub init
for n=1 to 2
 gosub creuse:gosub vide:t=20:s=-1:gosub translation:gosub vue
next n

return


' creation du robot dumper
dumper:
3d_mesh 20
3d_load_object 20,"dumper.3ds"
3d_color 20,250,150,0
3d_position 20,0,1.1,20
3d_x_rotate 20,180
3d_scale 20,1.7,1.3,1.5


return

' creation du robot minipelle
minipelle:
3d_mesh 5
3d_load_object 5,"chaine.3ds"
3d_color 5,133,107,34


3d_mesh 6
3d_load_object 6,"chassi.3ds"
3d_chain 6,5
3d_color 6,250,150,0

3d_mesh 7
3d_load_object 7,"vitre.3ds"
3d_chain 7,6
3d_color 7,76,98,112

3d_mesh 8
3d_load_object 8,"bras1.3ds"
3d_chain 8,7
3d_color 8,250,150,0
3d_position 8,0,1.2,1.3

3d_mesh 9
3d_load_object 9,"bras2.3ds"
3d_chain 9,8
3d_color 9,250,150,0
3d_position 9,0,1.7,2

3d_mesh 10
3d_load_object 10,"godet.3ds"
3d_chain 10,9
3d_color 10,86,76,47
3d_position 10,0,-1.1,0.9

3d_mesh 11
3d_load_object 11,"lame.3ds"
3d_chain 11,5
3d_color 11,86,76,47
3d_position 11,0,0.5,1

3d_position 5,0,0,3
3d_y_rotate 5,140

gosub vue

rem sound 2 : file_load 2,"moteur.wav"
sound 7 : file_load 7,"klaxon.wav"

return

' utilisation direct des robots
manuel:
hide 200
rem    rem  delete 2
rem    rem  sound 2 : file_load 2,"moteur.wav"
if moteur=1
rem  play 2
  if touche_t+ touche_y=2 then 3d_move 5,0.03
  if touche_g=1 and touche_h=1 then 3d_move 5,(-0.03)
  if touche_t=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.4
  if touche_h=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.4
  if touche_y=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.4
  if touche_g=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.4
  if touche_q = 1 then 3d_y_rotate 6,o3d_y_rotate(6)+0.5
  if touche_d = 1 then 3d_y_rotate 6,o3d_y_rotate(6)-0.5
  if touche_e = 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
  if touche_s = 1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.7
  if touche_l = 1 and o3d_x_rotate(8) > -70 then 3d_x_rotate 8,o3d_x_rotate(8)-0.3
  if touche_o = 1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
  if touche_k = 1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
  if touche_m = 1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.7
  if touche_bas = 1 and o3d_x_rotate(11) > -5 then 3d_x_rotate 11,o3d_x_rotate(11)-0.13
  if touche_haut = 1 and o3d_x_rotate(11) < 8 then 3d_x_rotate 11,o3d_x_rotate(11)+0.13
end_if


if touche_espace = 1
  play 7
end_if
touche_espace = 0

if touche_echap = 1
timer_off 1
show 200
show 300
end_if
gosub vue
return

'camera
vue:
cam_position o3d_x_position(1),o3d_y_position(1),o3d_z_position(1)
point_position o3d_x_position(2),o3d_y_position(2),o3d_z_position(2)
return

bibliotheque_touche_1:
if key_down_code = 68 then touche_d=1
if key_down_code = 69 then touche_e=1
if key_down_code = 71 then touche_g=1
if key_down_code = 72 then touche_h=1
if key_down_code = 75 then touche_k=1
if key_down_code = 76 then touche_l=1
if key_down_code = 77 then touche_m=1
if key_down_code = 79 then touche_o=1
if key_down_code = 81 then touche_q=1
if key_down_code = 83 then touche_s=1
if key_down_code = 84 then touche_t=1
if key_down_code = 89 then touche_y=1
if key_down_code = 27 then touche_echap=1
if key_down_code = 8 then touche_retour=1
if key_down_code = 13 then touche_enter=1
if key_down_code = 32 then touche_espace=1
if key_down_code = 38 then touche_haut=1
if key_down_code = 40 then touche_bas=1
return

bibliotheque_touche_2:
if key_up_code = 68 then touche_d=0
if key_up_code = 69 then touche_e=0
if key_up_code = 71 then touche_g=0
if key_up_code = 72 then touche_h=0
if key_up_code = 75 then touche_k=0
if key_up_code = 76 then touche_l=0
if key_up_code = 77 then touche_m=0
if key_up_code = 79 then touche_o=0
if key_up_code = 81 then touche_q=0
if key_up_code = 83 then touche_s=0
if key_up_code = 84 then touche_t=0
if key_up_code = 89 then touche_y=0
if key_up_code = 27 then touche_echap=0
if key_up_code = 8 then touche_retour=0
if key_up_code = 13 then touche_enter=0
if key_up_code = 38 then touche_haut=0
if key_up_code = 40 then touche_bas=0
return
'mise en pausition, de depart
init:
for i=1 to 250
if i>1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
if i>1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.7
if i>1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
pause 4
next i
return

translation:
for i=1 to t
3d_move 5,s*(0.03 )
pause 10
next i
return

rotation:
for i=1 to r
3d_y_rotate 5,o3d_y_rotate (5)+ s*(0.4)
pause 10
next i
return

tourne:
for i=1 to tou
3d_y_rotate 6,o3d_y_rotate (6)+(s*(0.5))
pause 10
next i
return
'creuse au sol a partir de la position init
creuse:
for i=1 to 300
 if i> 1 and o3d_x_rotate(8) > -40 then 3d_x_rotate 8,o3d_x_rotate(8)-0.3
 if i> 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
 if i>1 and o3d_x_rotate(10) < 10 then 3d_x_rotate 10,o3d_x_rotate(10)+0.7
 pause 5
next i
for i=1 to 50
 if i> 1 and o3d_x_rotate(8) > -50 then 3d_x_rotate 8,o3d_x_rotate(8)-0.3
 pause 5
next i
for i=1 to 50
if i> 1 and o3d_x_rotate(10) > -20 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
pause 5
next i
for i=1 to 200
if i> 1 and o3d_x_rotate(8) < -10 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
if i> 1 and o3d_x_rotate(9) > -10 then 3d_x_rotate 9,o3d_x_rotate(9)-0.7
if i>1 and o3d_x_rotate(10) > -90 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
pause 5
next i
return
'vide le godet en hauteur
vide:
for i=1 to 100
if i> 1 and o3d_x_rotate(8) < 20 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
if i> 1 and o3d_x_rotate(9) < 20 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
if i>1 and o3d_x_rotate(10) > -110 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
pause 5
next i
tou=180 : s=-1
gosub tourne
for i=1 to 200
if i> 1 and o3d_x_rotate(9) < 50 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
if i>1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.7
pause 5
next i
tou=180 : s=1
gosub tourne


return
test:

return

quit:
rem rem  delete 2
  delete 7
 3d_chain_break 6,5
 3d_chain_break 7,6
 3d_chain_break 8,7
 3d_chain_break 9,8
 3d_chain_break 10,9
 3d_chain_break 11,5
terminate
return


je mets le fichier dans mon webdev
essayez de me dire ce qui ne vas pas
bonsoir a tous
Mindstorm
Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: enfin le robot est autonome   robotique et Panoramic - Page 3 EmptyMer 24 Avr 2013 - 22:59

bonsoir a tous
un rayon de soleil apres avoir vu les realisation de vous tous
enfin le robot est autonome
rien de genial mais ça marche Very Happy Very Happy Very Happy



Code:
dim touche_d,touche_e,touche_g,touche_h,touche_k,touche_l,touche_m,touche_o,touche_q,touche_s,touche_t,touche_y,
dim touche_echap,touche_retour,touche_enter,touche_espace,touche_haut,touche_bas
dim x2,x6,z2,z6,yr6,x3,y3,i
dim moteur, son2 ,son7 ,ok
dim t,r,tou,cr,vi,te,s,n
dim g,gh$,gx$ ,f,fh$,fx$,fz$

label manuel , vue ,quit,prog ,minipelle,initm,initauto,dumper,programme
label bibliotheque_touche_1 , bibliotheque_touche_2
label translation,rotation,tourne,creuse,vide,test,init
moteur=0 : ok=0
scene3d 99
full_space 0 :  full_space 99  : border_hide 0
color 99,0,0,200

3D_SKYBOX 3
3D_LOAD_TEXTURE_TOP 3,"skybox_top.jpg"
3D_LOAD_TEXTURE_LEFT 3,"bskybox_left.jpg"
3D_LOAD_TEXTURE_BACK 3,"bskybox_back.jpg"
3D_LOAD_TEXTURE_FRONT 3,"bskybox_front.jpg"
3D_LOAD_TEXTURE_RIGHT 3,"bskybox_right.jpg"

fog_on
fog_distance_min 5
fog_distance_max 700
fog_color 219,243,165

3d_plane 4
3d_scale 4,50,50,50
3d_x_rotate 4,90
3d_y_position 4,0
3d_load_texture 4,"herbe2.JPG"
3d_u_tile 4,400
3d_v_tile 4,400


3d_plane 14
3d_scale 14,5,5,1
3d_x_rotate 14,90
3d_y_position 14,0.02
 3d_color 14,89,75,18

3d_cube 1,1:3d_position 1,35,6,0
3d_cube 2,2 :3d_position 2,-20,0,20

' generation du terrain de jeu

3d_cube 400,1 :3d_position 400,0,0,25 :3d_color 400,164,155,49
3D_x_scale 400,50 :3d_collision_as_faces 400
3d_cube 401,1 :3d_position 401,-25,0,0 :3d_color 401,164,155,49
3d_z_scale 401,50 :3d_collision_as_faces 401
3d_cube 402,1 :3d_position 402,0,0,-25 :3d_color 402,164,155,49
3D_x_scale 402,50 :3d_collision_as_faces 402
3d_cube 403,1 :3d_position 403,25,0,-14 :3d_color 403,164,155,49
3d_z_scale 403,23 :3d_collision_as_faces 403
3d_cube 404,1 :3d_position 404,25,0,14 :3d_color 404,164,155,49
3D_z_scale 404,23 :3d_collision_as_faces 404

3d_cube 399,1 :3d_position 399,27,0,0


light_position -99,90,130
gosub vue

gosub minipelle
command_target_is 0



form 200 :left 200,700
caption 200,"poste de commande"
command_target_is 200
button 100 : top 100,100 : left 100,10 : caption 100,"mode manuel" : on_click 100,initm
button 101 : top 101,125 : left 101,10 :caption 101,"lancement prog": on_click 101,initauto
button 102 : top 102,150 : left 102,10 : caption 102,"QUITTER" : on_click 102,quit
alpha 103 : top 103, 20 : left 103,10 : caption 103, "positionner votre pelle en manuel et lancez le programme"

form 300
 caption 300,"poste de pilotage"
 command_target_is 300
 alpha 301:left 301,100: top 301,150
 caption 301,"    E      TY      O"
 alpha 302:left 302,100: top 302,168
 caption 302,"  QSD  GH    KLM"
 alpha 303:left 303,10: top 303,118
 caption 303,"-- en mode manuel      stop= esc -- "

timer 1 : timer_interval 1,1

end


'initialisation manu
initm:
on_key_down 0,bibliotheque_touche_1
on_key_up 0,bibliotheque_touche_2
moteur=1 :ok=1
on_timer 1,manuel
return

'initialisation auto
initauto:
hide 200
hide 300
gosub prog
show 200:command_target_is 200
return

'creation du programme
programme:

return

'exemple de programme a executer
prog:
gosub init
rem for n=1 to 2
rem gosub creuse:gosub vide:t=20:s=-1:gosub translation:gosub vue
rem next n

for n=1 to 50
t=20:s=1:gosub translation:gosub test
next n

return


' creation du robot dumper
dumper:
3d_mesh 20
3d_load_object 20,"dumper.3ds"
3d_color 20,250,150,0
3d_position 20,0,1.1,20
3d_x_rotate 20,180
3d_scale 20,1.7,1.3,1.5
3d_collision_as_faces 20

return

' creation du robot minipelle
minipelle:
3d_mesh 5
3d_load_object 5,"chaine.3ds"
3d_collision_as_faces 5
3d_color 5,133,107,34


3d_mesh 6
3d_load_object 6,"chassi.3ds"
3d_chain 6,5
3d_color 6,250,150,0

3d_mesh 7
3d_load_object 7,"vitre.3ds"
3d_chain 7,6
3d_color 7,76,98,112

3d_mesh 8
3d_load_object 8,"bras1.3ds"
3d_chain 8,7
3d_color 8,250,150,0
3d_position 8,0,1.2,1.3

3d_mesh 9
3d_load_object 9,"bras2.3ds"
3d_chain 9,8
3d_color 9,250,150,0
3d_position 9,0,1.7,2

3d_mesh 10
3d_load_object 10,"godet.3ds"
3d_collision_as_faces 10
3d_chain 10,9
3d_color 10,86,76,47
3d_position 10,0,-1.1,0.9

3d_mesh 11
3d_load_object 11,"lame.3ds"
3d_collision_as_faces 11
3d_chain 11,5
3d_color 11,86,76,47
3d_position 11,0,0.5,1

3d_position 5,0,0,3
3d_y_rotate 5,140

gosub vue

rem sound 2 : file_load 2,"moteur.wav"
sound 7 : file_load 7,"klaxon.wav"

return

' utilisation direct des robots
manuel:
hide 200
rem    rem  delete 2
rem    rem  sound 2 : file_load 2,"moteur.wav"
if moteur=1
rem  play 2
  if touche_t+ touche_y=2 then 3d_move 5,0.03
  if touche_g=1 and touche_h=1 then 3d_move 5,(-0.03)
  if touche_t=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.4
  if touche_h=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.4
  if touche_y=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.4
  if touche_g=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.4
  if touche_q = 1 then 3d_y_rotate 6,o3d_y_rotate(6)+0.5
  if touche_d = 1 then 3d_y_rotate 6,o3d_y_rotate(6)-0.5
  if touche_e = 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
  if touche_s = 1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.7
  if touche_l = 1 and o3d_x_rotate(8) > -70 then 3d_x_rotate 8,o3d_x_rotate(8)-0.3
  if touche_o = 1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
  if touche_k = 1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
  if touche_m = 1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.7
  if touche_bas = 1 and o3d_x_rotate(11) > -5 then 3d_x_rotate 11,o3d_x_rotate(11)-0.13
  if touche_haut = 1 and o3d_x_rotate(11) < 8 then 3d_x_rotate 11,o3d_x_rotate(11)+0.13
end_if


if touche_espace = 1
  play 7
end_if
touche_espace = 0

if touche_echap = 1
timer_off 1
show 200
show 300
end_if
gosub vue
return

'camera
vue:
cam_position o3d_x_position(1),o3d_y_position(1),o3d_z_position(1)
point_position o3d_x_position(2),o3d_y_position(2),o3d_z_position(2)
return

bibliotheque_touche_1:
if key_down_code = 68 then touche_d=1
if key_down_code = 69 then touche_e=1
if key_down_code = 71 then touche_g=1
if key_down_code = 72 then touche_h=1
if key_down_code = 75 then touche_k=1
if key_down_code = 76 then touche_l=1
if key_down_code = 77 then touche_m=1
if key_down_code = 79 then touche_o=1
if key_down_code = 81 then touche_q=1
if key_down_code = 83 then touche_s=1
if key_down_code = 84 then touche_t=1
if key_down_code = 89 then touche_y=1
if key_down_code = 27 then touche_echap=1
if key_down_code = 8 then touche_retour=1
if key_down_code = 13 then touche_enter=1
if key_down_code = 32 then touche_espace=1
if key_down_code = 38 then touche_haut=1
if key_down_code = 40 then touche_bas=1
return

bibliotheque_touche_2:
if key_up_code = 68 then touche_d=0
if key_up_code = 69 then touche_e=0
if key_up_code = 71 then touche_g=0
if key_up_code = 72 then touche_h=0
if key_up_code = 75 then touche_k=0
if key_up_code = 76 then touche_l=0
if key_up_code = 77 then touche_m=0
if key_up_code = 79 then touche_o=0
if key_up_code = 81 then touche_q=0
if key_up_code = 83 then touche_s=0
if key_up_code = 84 then touche_t=0
if key_up_code = 89 then touche_y=0
if key_up_code = 27 then touche_echap=0
if key_up_code = 8 then touche_retour=0
if key_up_code = 13 then touche_enter=0
if key_up_code = 38 then touche_haut=0
if key_up_code = 40 then touche_bas=0
return
'mise en pausition, de depart
init:
for i=1 to 250
if i>1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
if i>1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.7
if i>1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
pause 4
next i
return

translation:
for i=1 to t
3d_move 5,s*(0.03 )
pause 10
next i
return

rotation:
for i=1 to r
3d_y_rotate 5,o3d_y_rotate (5)+ s*(0.4)
pause 10
next i
return

tourne:
for i=1 to tou
3d_y_rotate 6,o3d_y_rotate (6)+(s*(0.5))
pause 10
next i
return
'creuse au sol a partir de la position init
creuse:
for i=1 to 300
 if i> 1 and o3d_x_rotate(8) > -40 then 3d_x_rotate 8,o3d_x_rotate(8)-0.3
 if i> 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
 if i>1 and o3d_x_rotate(10) < 10 then 3d_x_rotate 10,o3d_x_rotate(10)+0.7
 pause 5
next i
for i=1 to 50
 if i> 1 and o3d_x_rotate(8) > -50 then 3d_x_rotate 8,o3d_x_rotate(8)-0.3
 pause 5
next i
for i=1 to 50
if i> 1 and o3d_x_rotate(10) > -20 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
pause 5
next i
for i=1 to 200
if i> 1 and o3d_x_rotate(8) < -10 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
if i> 1 and o3d_x_rotate(9) > -10 then 3d_x_rotate 9,o3d_x_rotate(9)-0.7
if i>1 and o3d_x_rotate(10) > -90 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
pause 5
next i
return
'vide le godet en hauteur
vide:
for i=1 to 100
if i> 1 and o3d_x_rotate(8) < 20 then 3d_x_rotate 8,o3d_x_rotate(8)+0.3
if i> 1 and o3d_x_rotate(9) < 20 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
if i>1 and o3d_x_rotate(10) > -110 then 3d_x_rotate 10,o3d_x_rotate(10)-0.7
pause 5
next i
tou=180 : s=-1
gosub tourne
for i=1 to 200
if i> 1 and o3d_x_rotate(9) < 50 then 3d_x_rotate 9,o3d_x_rotate(9)+0.7
if i>1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.7
pause 5
next i
tou=180 : s=1
gosub tourne


return
test:
if o3d_collision (11,400) =1 then r=60:s=1:gosub rotation
if o3d_collision (11,401) =1 then r=60:s=1:gosub rotation
if o3d_collision (11,402) =1 then r=60:s=1:gosub rotation
if o3d_collision (11,403) =1 then r=60:s=1:gosub rotation
if o3d_collision (11,404) =1 then r=60:s=1:gosub rotation
return

quit:
rem rem  delete 2
  delete 7
 3d_chain_break 6,5
 3d_chain_break 7,6
 3d_chain_break 8,7
 3d_chain_break 9,8
 3d_chain_break 10,9
 3d_chain_break 11,5
terminate
return


il reste de plus en plus vrai que je manque de methode
mindstorm
Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyMar 30 Avr 2013 - 21:10

BONSOIR A TOUS
par suite de l'article de Jack
voici une vertion avec suivie camera et surtout plus de vitesse
je n'ai pas remis le son mais chacun peut le faire en suprimant quelques rem
je patauge dans mon boulot donc pas encore de creation de programme interactif, mais ça viens Wink

Code:
dim touche_d,touche_e,touche_g,touche_h,touche_k,touche_l,touche_m,touche_o,touche_q,touche_s,touche_t,touche_y,
dim touche_echap,touche_retour,touche_enter,touche_espace,touche_haut,touche_bas
dim x2,x6,z2,z6,yr6,x3,y3,i,dxcam
dim moteur, son2 ,son7 ,ok
dim t,r,tou,cr,vi,te,s,n
dim g,gh$,gx$ ,f,fh$,fx$,fz$

label manuel , vue ,quit,prog ,minipelle,initm,initauto,dumper,programme
label bibliotheque_touche_1 , bibliotheque_touche_2
label translation,rotation,tourne,creuse,vide,test,init
moteur=0 : ok=0
scene3d 99
full_space 0 :  full_space 99  : border_hide 0
color 99,0,0,200

3D_SKYBOX 3
3D_LOAD_TEXTURE_TOP 3,"skybox_top.jpg"
3D_LOAD_TEXTURE_LEFT 3,"bskybox_left.jpg"
3D_LOAD_TEXTURE_BACK 3,"bskybox_back.jpg"
3D_LOAD_TEXTURE_FRONT 3,"bskybox_front.jpg"
3D_LOAD_TEXTURE_RIGHT 3,"bskybox_right.jpg"

fog_on
fog_distance_min 5
fog_distance_max 700
fog_color 219,243,165

3d_plane 4
3d_scale 4,50,50,50
3d_x_rotate 4,90
3d_y_position 4,0
3d_load_texture 4,"herbe2.JPG"
3d_u_tile 4,400
3d_v_tile 4,400


3d_plane 14
3d_scale 14,5,5,1
3d_x_rotate 14,90
3d_y_position 14,0.02
 3d_color 14,89,75,18

3d_cube 1,1:3d_position 1,35,6,0
3d_cube 2,2 :3d_position 2,-20,0,20

' generation du terrain de jeu

3d_cube 400,1 :3d_position 400,0,0,25 :3d_hide 400
3D_x_scale 400,50 :3d_collision_as_faces 400
3d_cube 401,1 :3d_position 401,-25,0,0 :3d_hide 401
3d_z_scale 401,50 :3d_collision_as_faces 401
3d_cube 402,1 :3d_position 402,0,0,-25 :3d_hide 402
3D_x_scale 402,50 :3d_collision_as_faces 402
3d_cube 403,1 :3d_position 403,25,0,-14 :3d_hide 403
3d_z_scale 403,23 :3d_collision_as_faces 403
3d_cube 404,1 :3d_position 404,25,0,14 :3d_hide 404
3D_z_scale 404,23 :3d_collision_as_faces 404

3d_cube 399,1 :3d_position 399,27,0,0


light_position -99,90,130
gosub vue

gosub minipelle
command_target_is 0



form 200 :left 200,700
caption 200,"poste de commande"
command_target_is 200
button 100 : top 100,100 : left 100,10 : caption 100,"mode manuel" : on_click 100,initm
button 101 : top 101,125 : left 101,10 :caption 101,"lancement prog": on_click 101,initauto
button 102 : top 102,150 : left 102,10 : caption 102,"QUITTER" : on_click 102,quit
alpha 103 : top 103, 20 : left 103,10 : caption 103, "positionner votre pelle en manuel et lancez le programme"

form 300
 caption 300,"poste de pilotage"
 command_target_is 300
 alpha 301:left 301,100: top 301,150
 caption 301,"    E      TY      O"
 alpha 302:left 302,100: top 302,168
 caption 302,"  QSD  GH    KLM"
 alpha 303:left 303,10: top 303,118
 caption 303,"-- en mode manuel      stop= esc -- "

timer 1 : timer_interval 1,1

end


'initialisation manu
initm:
on_key_down 0,bibliotheque_touche_1
on_key_up 0,bibliotheque_touche_2
moteur=1 :ok=1
on_timer 1,manuel
return

'initialisation auto
initauto:
hide 200
hide 300
gosub prog
show 200:command_target_is 200
return

'creation du programme
programme:

return

'exemple de programme a executer
prog:
gosub init
rem for n=1 to 2
rem gosub creuse:gosub vide:t=20:s=-1:gosub translation:gosub vue
rem next n

for n=1 to 50
t=20:s=1:gosub translation
gosub test
next n

return


' creation du robot dumper
dumper:
3d_mesh 20
3d_load_object 20,"dumper.3ds"
3d_color 20,250,150,0
3d_position 20,0,1.1,20
3d_x_rotate 20,180
3d_scale 20,1.7,1.3,1.5
3d_collision_as_faces 20

return

' creation du robot minipelle
minipelle:
3d_mesh 5
3d_load_object 5,"chaine.3ds"
3d_collision_as_faces 5
3d_color 5,133,107,34


3d_mesh 6
3d_load_object 6,"chassi.3ds"
3d_chain 6,5
3d_color 6,250,150,0

3d_mesh 7
3d_load_object 7,"vitre.3ds"
3d_chain 7,6
3d_color 7,76,98,112

3d_mesh 8
3d_load_object 8,"bras1.3ds"
3d_chain 8,7
3d_color 8,250,150,0
3d_position 8,0,1.2,1.3

3d_mesh 9
3d_load_object 9,"bras2.3ds"
3d_chain 9,8
3d_color 9,250,150,0
3d_position 9,0,1.7,2

3d_mesh 10
3d_load_object 10,"godet.3ds"
3d_collision_as_faces 10
3d_chain 10,9
3d_color 10,86,76,47
3d_position 10,0,-1.1,0.9

3d_mesh 11
3d_load_object 11,"lame.3ds"
3d_collision_as_faces 11
3d_chain 11,5
3d_color 11,86,76,47
3d_position 11,0,0.5,1

3d_position 5,0,0,3
3d_y_rotate 5,140

gosub vue

rem sound 2 : file_load 2,"moteur.wav"
sound 7 : file_load 7,"klaxon.wav"

return

' utilisation direct des robots
manuel:
hide 200
rem    rem  delete 2
rem    rem  sound 2 : file_load 2,"moteur.wav"
if moteur=1
rem  play 2
  if touche_t+ touche_y=2 then 3d_move 5,0.05
  if touche_g=1 and touche_h=1 then 3d_move 5,(-0.05)
  if touche_t=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.6
  if touche_h=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.6
  if touche_y=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.6
  if touche_g=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.6
  if touche_q = 1 then 3d_y_rotate 6,o3d_y_rotate(6)+0.7
  if touche_d = 1 then 3d_y_rotate 6,o3d_y_rotate(6)-0.7
  if touche_e = 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
  if touche_s = 1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
  if touche_l = 1 and o3d_x_rotate(8) > -70 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
  if touche_o = 1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
  if touche_k = 1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
  if touche_m = 1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
  if touche_bas = 1 and o3d_x_rotate(11) > -5 then 3d_x_rotate 11,o3d_x_rotate(11)-0.13
  if touche_haut = 1 and o3d_x_rotate(11) < 8 then 3d_x_rotate 11,o3d_x_rotate(11)+0.13
end_if


if touche_espace = 1
  play 7
end_if
touche_espace = 0

if touche_echap = 1
timer_off 1
show 200
show 300
end_if
rem gosub vue
point_position o3d_x_position(5),o3d_y_position(5),o3d_z_position(5)
return

'camera
vue:
cam_position o3d_x_position(1),o3d_y_position(1),o3d_z_position(1)
point_position o3d_x_position(2),o3d_y_position(2),o3d_z_position(2)
return
'tranduction non obligatoire mais j'y tiens
bibliotheque_touche_1:
if key_down_code = 68 then touche_d=1
if key_down_code = 69 then touche_e=1
if key_down_code = 71 then touche_g=1
if key_down_code = 72 then touche_h=1
if key_down_code = 75 then touche_k=1
if key_down_code = 76 then touche_l=1
if key_down_code = 77 then touche_m=1
if key_down_code = 79 then touche_o=1
if key_down_code = 81 then touche_q=1
if key_down_code = 83 then touche_s=1
if key_down_code = 84 then touche_t=1
if key_down_code = 89 then touche_y=1
if key_down_code = 27 then touche_echap=1
if key_down_code = 8 then touche_retour=1
if key_down_code = 13 then touche_enter=1
if key_down_code = 32 then touche_espace=1
if key_down_code = 38 then touche_haut=1
if key_down_code = 40 then touche_bas=1
return

bibliotheque_touche_2:
if key_up_code = 68 then touche_d=0
if key_up_code = 69 then touche_e=0
if key_up_code = 71 then touche_g=0
if key_up_code = 72 then touche_h=0
if key_up_code = 75 then touche_k=0
if key_up_code = 76 then touche_l=0
if key_up_code = 77 then touche_m=0
if key_up_code = 79 then touche_o=0
if key_up_code = 81 then touche_q=0
if key_up_code = 83 then touche_s=0
if key_up_code = 84 then touche_t=0
if key_up_code = 89 then touche_y=0
if key_up_code = 27 then touche_echap=0
if key_up_code = 8 then touche_retour=0
if key_up_code = 13 then touche_enter=0
if key_up_code = 38 then touche_haut=0
if key_up_code = 40 then touche_bas=0
return
'mise en pausition, de depart
init:
for i=1 to 250
if i>1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i>1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
if i>1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 4
next i
return

translation:
for i=1 to t
3d_move 5,s*(0.05 )
pause 10
gosub test
next i
return

rotation:
for i=1 to r
3d_y_rotate 5,o3d_y_rotate (5)+ s*(0.7)
pause 10
next i
return

tourne:
for i=1 to tou
3d_y_rotate 6,o3d_y_rotate (6)+(s*(0.7))
pause 10
next i
return
'creuse au sol a partir de la position init
creuse:
for i=1 to 300
 if i> 1 and o3d_x_rotate(8) > -40 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
 if i> 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
 if i>1 and o3d_x_rotate(10) < 10 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
 pause 5
next i
for i=1 to 50
 if i> 1 and o3d_x_rotate(8) > -50 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
 pause 5
next i
for i=1 to 50
if i> 1 and o3d_x_rotate(10) > -20 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
for i=1 to 200
if i> 1 and o3d_x_rotate(8) < -10 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i> 1 and o3d_x_rotate(9) > -10 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
if i>1 and o3d_x_rotate(10) > -90 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
return
'vide le godet en hauteur
vide:
for i=1 to 100
if i> 1 and o3d_x_rotate(8) < 20 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i> 1 and o3d_x_rotate(9) < 20 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
if i>1 and o3d_x_rotate(10) > -110 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
tou=180 : s=-1
gosub tourne
for i=1 to 200
if i> 1 and o3d_x_rotate(9) < 50 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
if i>1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
pause 5
next i
tou=180 : s=1
gosub tourne

return
'essai de test
test:
if o3d_collision (11,400) =1 then r=90:s=1:gosub rotation
if o3d_collision (11,401) =1 then r=50:s=2:gosub rotation
if o3d_collision (11,402) =1 then r=80:s=1:gosub rotation
if o3d_collision (11,403) =1 then r=70:s=2:gosub rotation
if o3d_collision (11,404) =1 then r=70:s=1:gosub rotation
point_position o3d_x_position(5),o3d_y_position(5),o3d_z_position(5)
return

quit:
rem rem  delete 2
  delete 7
 3d_chain_break 6,5
 3d_chain_break 7,6
 3d_chain_break 8,7
 3d_chain_break 9,8
 3d_chain_break 10,9
 3d_chain_break 11,5
terminate
return


ce serai utile pour moi si jicehel ou geronimy ou d autre, la porte est largement ouverte sunny
pouvaient tenter de faire une programmation du robot et la poster king cela me permettra d'identifier les besoins vitaux
par la suite nous feront un defi jeune pour les enfants
bonne soirée
Mindstorm
Revenir en haut Aller en bas
Jicehel

Jicehel


Nombre de messages : 5947
Age : 51
Localisation : 77500
Date d'inscription : 18/04/2011

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyMar 30 Avr 2013 - 23:55

Je ne vais pas être trop présent dans les 10 jours qui viennent désolé. En attendant, tu peux monter un peu le délai pour le timer (ligne 88, je réglerai le timer sur un interval de 50 pour ne pas consommer trop de ressources pour rien)

Sinon, ton programme ne peut pas marcher en mode manuel sauf erreur de ma part puisque tu n'as plus de gestion de l'allumage du moteur donc perso, j'ai mis directement la variable moteur à 1.

Par contre tu sais, je manque cruellement de temps et je n'arrive déjà pas à faire ce que je voudrais alors mieux vaut que tu prennes ton temps et que tu code toi même ce que tu souhaites. Je crois que nous sommes beaucoup dans mon cas, même si nous prenons toujours quelques minutes si quelqu'un bloque sur quelque chose (enfin tout le monde ne prend pas tout le temps le temps faute de temps, mais dans un temps souvent court il y a tout le temps quelqu'un qui le prend...)
Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyMer 1 Mai 2013 - 11:58

Bonjour a tous
Cool
petite rectification IL n y a rien d URGENT Razz

Merci jicehel pour tes tuyaux
je crois que le probleme sur la reprise en mod sur la reprise du mode manuel est
sur la temporisation que je ne relance pas comme il faut

encore merci
mindstorm
Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyMer 1 Mai 2013 - 22:25

bonsoir a tous
de quoi vous aider a reflechir Suspect
Code:
dim touche_d,touche_e,touche_g,touche_h,touche_k,touche_l,touche_m,touche_o,touche_q,touche_s,touche_t,touche_y,
dim touche_echap,touche_retour,touche_enter,touche_espace,touche_haut,touche_bas
dim x2,x6,z2,z6,yr6,x3,y3,i,dxcam
dim moteur, son2 ,son7 ,ok,m
dim t,r,tou,cr,vi,te,s,n
dim g,gh$,gx$ ,f,fh$,fx$,fz$

label manuel , vue ,quit,prog ,minipelle,initm,initauto,dumper,programme
label bibliotheque_touche_1 , bibliotheque_touche_2
label translation,rotation,tourne,creuse,vide,test,init
moteur=0 : ok=0
scene3d 99
full_space 0 :  full_space 99  : border_hide 0
color 99,0,0,200

3D_SKYBOX 3
3D_LOAD_TEXTURE_TOP 3,"skybox_top.jpg"
3D_LOAD_TEXTURE_LEFT 3,"bskybox_left.jpg"
3D_LOAD_TEXTURE_BACK 3,"bskybox_back.jpg"
3D_LOAD_TEXTURE_FRONT 3,"bskybox_front.jpg"
3D_LOAD_TEXTURE_RIGHT 3,"bskybox_right.jpg"

fog_on
fog_distance_min 5
fog_distance_max 700
fog_color 219,243,165

3d_plane 4
3d_scale 4,50,50,50
3d_x_rotate 4,90
3d_y_position 4,0
3d_load_texture 4,"herbe2.JPG"
3d_u_tile 4,400
3d_v_tile 4,400


3d_plane 14
3d_scale 14,5,5,1
3d_x_rotate 14,90
3d_y_position 14,0.02
 3d_color 14,89,75,18

3d_cube 1,1:3d_position 1,35,6,0
3d_cube 2,2 :3d_position 2,-20,-4,5: 3d_hide 2


' generation du terrain de jeu

3d_cube 400,1 :3d_position 400,0,0,25 :3d_hide 400
3D_x_scale 400,50 :3d_collision_as_faces 400
3d_cube 401,1 :3d_position 401,-25,0,0 :3d_hide 401
3d_z_scale 401,50 :3d_collision_as_faces 401
3d_cube 402,1 :3d_position 402,0,0,-25 :3d_hide 402
3D_x_scale 402,50 :3d_collision_as_faces 402
3d_cube 403,1 :3d_position 403,25,0,-14 :3d_hide 403
3d_z_scale 403,23 :3d_collision_as_faces 403
3d_cube 404,1 :3d_position 404,25,0,14 :3d_hide 404
3D_z_scale 404,23 :3d_collision_as_faces 404

3d_cube 405,1 :3d_position 405,0,0,10
3D_x_scale 405,21 :3d_collision_as_faces 405
3d_cube 406,1 :3d_position 406,-10,0,0
3d_z_scale 406,21 :3d_collision_as_faces 406
3d_cube 407,1 :3d_position 407,0,0,-10
3D_x_scale 407,21 :3d_collision_as_faces 407
3d_cube 408,1 :3d_position 408,10,0,-6
3d_z_scale 408,7.5 :3d_collision_as_faces 408
3d_cube 409,1 :3d_position 409,10,0,6
3D_z_scale 409,7.5 :3d_collision_as_faces 409


 ' création texte
3d_text 307,"pour sortir[esc]"
3d_y_rotate 307,180
3d_scale 307,4,4,4
3d_color 307,231,219,41
3d_x_position 307,5
3d_y_position 307,2
3d_z_position 307,40

3d_text 306,"pour avancer [TY]"
3d_y_rotate 306,180
3d_scale 306,4,4,4
3d_color 306,231,219,41
3d_x_position 306,10
3d_y_position 306,10
3d_z_position 306,40

3d_text 305,"pour reculer  [GH]"
3d_y_rotate 305,180
3d_scale 305,4,4,4
3d_color 305,231,219,41
3d_x_position 305,10
3d_y_position 305,6
3d_z_position 305,40

light_position -99,90,130
gosub vue

gosub minipelle
command_target_is 0



form 200 :left 200,700
caption 200,"poste de commande"
command_target_is 200
button 100 : top 100,50 : left 100,10 :width 100,150: caption 100,"mise en place manuel" : on_click 100,initm
button 101 : top 101,80 : left 101,10 :width 101,150:caption 101,"lancement programme": on_click 101,initauto
button 102 : top 102,110 : left 102,10 : caption 102,"QUITTER" : on_click 102,quit
alpha 103 : top 103, 20 : left 103,10 : caption 103, "positionner votre pelle en manuel et lancez le programme"


timer 1 : timer_interval 1,15

end


'initialisation manu
initm:
on_key_down 0,bibliotheque_touche_1
on_key_up 0,bibliotheque_touche_2
moteur=1 :ok=1
on_timer 1,manuel
command_target_is 200
caption 100,"                "
caption 103, "                                                        "
command_target_is 0
return

'initialisation auto
initauto:
3D_hide 307
3D_hide 306
3D_hide 305
hide 200
gosub prog
command_target_is 200

show 200:command_target_is 200
caption 101,"relance programme      "
command_target_is 0
return

'creation du programme
programme:

return

'exemple de programme a executer
prog:
gosub init
rem for n=1 to 2
rem gosub creuse:gosub vide:t=20:s=-1:gosub translation:gosub vue
rem next n

for n=1 to 50
t=20:s=1:gosub translation
gosub test
next n

return


' creation du robot dumper
dumper:
3d_mesh 20
3d_load_object 20,"dumper.3ds"
3d_color 20,250,150,0
3d_position 20,0,1.1,20
3d_x_rotate 20,180
3d_scale 20,1.7,1.3,1.5
3d_collision_as_faces 20

return

' creation du robot minipelle
minipelle:
3d_mesh 5
3d_load_object 5,"chaine.3ds"
3d_collision_as_faces 5
3d_color 5,133,107,34


3d_mesh 6
3d_load_object 6,"chassi.3ds"
3d_chain 6,5
3d_color 6,250,150,0

3d_mesh 7
3d_load_object 7,"vitre.3ds"
3d_chain 7,6
3d_color 7,76,98,112

3d_mesh 8
3d_load_object 8,"bras1.3ds"
3d_chain 8,7
3d_color 8,250,150,0
3d_position 8,0,1.2,1.3

3d_mesh 9
3d_load_object 9,"bras2.3ds"
3d_chain 9,8
3d_color 9,250,150,0
3d_position 9,0,1.7,2

3d_mesh 10
3d_load_object 10,"godet.3ds"
3d_collision_as_faces 10
3d_chain 10,9
3d_color 10,86,76,47
3d_position 10,0,-1.1,0.9

3d_mesh 11
3d_load_object 11,"lame.3ds"
3d_collision_as_faces 11
3d_chain 11,5
3d_color 11,86,76,47
3d_position 11,0,0.5,1

3d_position 5,0,0,3
3d_y_rotate 5,140

gosub vue

rem sound 2 : file_load 2,"moteur.wav"
sound 7 : file_load 7,"klaxon.wav"

return

' utilisation direct des robots
manuel:
hide 200
rem    rem  delete 2
rem    rem  sound 2 : file_load 2,"moteur.wav"
rem if moteur=1
rem  play 2
  if touche_t+ touche_y=2 then 3d_move 5,0.05
  if touche_g=1 and touche_h=1 then 3d_move 5,(-0.05)
  if touche_t=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.6
  if touche_h=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.6
  if touche_y=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.6
  if touche_g=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.6
  if touche_q = 1 then 3d_y_rotate 6,o3d_y_rotate(6)+0.7
  if touche_d = 1 then 3d_y_rotate 6,o3d_y_rotate(6)-0.7
  if touche_e = 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
  if touche_s = 1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
  if touche_l = 1 and o3d_x_rotate(8) > -70 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
  if touche_o = 1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
  if touche_k = 1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
  if touche_m = 1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
  if touche_bas = 1 and o3d_x_rotate(11) > -5 then 3d_x_rotate 11,o3d_x_rotate(11)-0.13
  if touche_haut = 1 and o3d_x_rotate(11) < 8 then 3d_x_rotate 11,o3d_x_rotate(11)+0.13
rem end_if


if touche_espace = 1
  play 7
end_if
touche_espace = 0

if touche_echap = 1
timer_off 1
show 200
end_if
point_position o3d_x_position(5),o3d_y_position(5),o3d_z_position(5)
return

'camera
vue:
cam_position o3d_x_position(1),o3d_y_position(1),o3d_z_position(1)
point_position o3d_x_position(2),o3d_y_position(2),o3d_z_position(2)
return
'tranduction non obligatoire mais j'y tiens
bibliotheque_touche_1:
if key_down_code = 68 then touche_d=1
if key_down_code = 69 then touche_e=1
if key_down_code = 71 then touche_g=1
if key_down_code = 72 then touche_h=1
if key_down_code = 75 then touche_k=1
if key_down_code = 76 then touche_l=1
if key_down_code = 77 then touche_m=1
if key_down_code = 79 then touche_o=1
if key_down_code = 81 then touche_q=1
if key_down_code = 83 then touche_s=1
if key_down_code = 84 then touche_t=1
if key_down_code = 89 then touche_y=1
if key_down_code = 27 then touche_echap=1
if key_down_code = 8 then touche_retour=1
if key_down_code = 13 then touche_enter=1
if key_down_code = 32 then touche_espace=1
if key_down_code = 38 then touche_haut=1
if key_down_code = 40 then touche_bas=1
return

bibliotheque_touche_2:
if key_up_code = 68 then touche_d=0
if key_up_code = 69 then touche_e=0
if key_up_code = 71 then touche_g=0
if key_up_code = 72 then touche_h=0
if key_up_code = 75 then touche_k=0
if key_up_code = 76 then touche_l=0
if key_up_code = 77 then touche_m=0
if key_up_code = 79 then touche_o=0
if key_up_code = 81 then touche_q=0
if key_up_code = 83 then touche_s=0
if key_up_code = 84 then touche_t=0
if key_up_code = 89 then touche_y=0
if key_up_code = 27 then touche_echap=0
if key_up_code = 8 then touche_retour=0
if key_up_code = 13 then touche_enter=0
if key_up_code = 38 then touche_haut=0
if key_up_code = 40 then touche_bas=0
return
'mise en pausition, de depart
init:
for i=1 to 250
if i>1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i>1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
if i>1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 4
next i
return

translation:
for i=1 to t
3d_move 5,s*(0.09 )
pause 10
gosub test
next i
return

rotation:
for i=1 to r
3d_y_rotate 5,o3d_y_rotate (5)+ s*(0.7)
pause 10
next i
return

tourne:
for i=1 to tou
3d_y_rotate 6,o3d_y_rotate (6)+(s*(0.7))
pause 10
next i
return
'creuse au sol a partir de la position init
creuse:
for i=1 to 300
 if i> 1 and o3d_x_rotate(8) > -40 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
 if i> 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
 if i>1 and o3d_x_rotate(10) < 10 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
 pause 5
next i
for i=1 to 50
 if i> 1 and o3d_x_rotate(8) > -50 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
 pause 5
next i
for i=1 to 50
if i> 1 and o3d_x_rotate(10) > -20 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
for i=1 to 200
if i> 1 and o3d_x_rotate(8) < -10 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i> 1 and o3d_x_rotate(9) > -10 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
if i>1 and o3d_x_rotate(10) > -90 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
return
'vide le godet en hauteur
vide:
for i=1 to 100
if i> 1 and o3d_x_rotate(8) < 20 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i> 1 and o3d_x_rotate(9) < 20 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
if i>1 and o3d_x_rotate(10) > -110 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
tou=180 : s=-1
gosub tourne
for i=1 to 200
if i> 1 and o3d_x_rotate(9) < 50 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
if i>1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
pause 5
next i
tou=180 : s=1
gosub tourne

return
'essai de test
test:
if o3d_collision (11,400) =1 then r=90:s=1:gosub rotation
if o3d_collision (11,401) =1 then r=50:s=2:gosub rotation
if o3d_collision (11,402) =1 then r=80:s=1:gosub rotation
if o3d_collision (11,403) =1 then r=70:s=2:gosub rotation
if o3d_collision (11,404) =1 then r=70:s=1:gosub rotation
if o3d_collision (11,405) =1 then r=90:s=1:gosub rotation
if o3d_collision (11,406) =1 then r=50:s=2:gosub rotation
if o3d_collision (11,407) =1 then r=80:s=1:gosub rotation
if o3d_collision (11,408) =1 then r=70:s=2:gosub rotation
if o3d_collision (11,409) =1 then r=70:s=1:gosub rotation
point_position o3d_x_position(5),o3d_y_position(5),o3d_z_position(5)
return

quit:
rem rem  delete 2
  delete 7
 3d_chain_break 6,5
 3d_chain_break 7,6
 3d_chain_break 8,7
 3d_chain_break 9,8
 3d_chain_break 10,9
 3d_chain_break 11,5
terminate
return

il faut trouver le moyen de sortir
bon courage
mindstorm
Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyLun 6 Mai 2013 - 23:44

bonsoir a tous
enfin un menu deroulant
Code:
dim touche_d,touche_e,touche_g,touche_h,touche_k,touche_l,touche_m,touche_o,touche_q,touche_s,touche_t,touche_y,
dim touche_echap,touche_retour,touche_enter,touche_espace,touche_haut,touche_bas
dim x2,x6,z2,z6,yr6,x3,y3,i,dxcam
dim moteur, son2 ,son7 ,ok,m
dim t,r,tou,cr,vi,te,s,n
dim g,gh$,gx$ ,f,fh$,fx$,fz$

label manuel , vue ,quit,prog ,minipelle,initm,initauto,dumper,programme
label bibliotheque_touche_1 , bibliotheque_touche_2
label translation,rotation,tourne,creuse,vide,test,init
moteur=0 : ok=0
scene3d 99
full_space 0 :  full_space 99  : border_hide 0
color 99,0,0,200

3D_SKYBOX 3
3D_LOAD_TEXTURE_TOP 3,"skybox_top.jpg"
3D_LOAD_TEXTURE_LEFT 3,"bskybox_left.jpg"
3D_LOAD_TEXTURE_BACK 3,"bskybox_back.jpg"
3D_LOAD_TEXTURE_FRONT 3,"bskybox_front.jpg"
3D_LOAD_TEXTURE_RIGHT 3,"bskybox_right.jpg"

fog_on
fog_distance_min 5
fog_distance_max 700
fog_color 219,243,165

3d_plane 4
3d_scale 4,50,50,50
3d_x_rotate 4,90
3d_y_position 4,0
3d_load_texture 4,"herbe2.JPG"
3d_u_tile 4,400
3d_v_tile 4,400


3d_plane 14
3d_scale 14,5,5,1
3d_x_rotate 14,90
3d_y_position 14,0.02
 3d_color 14,89,75,18

3d_cube 1,1:3d_position 1,35,6,0
3d_cube 2,2 :3d_position 2,-20,-4,5: 3d_hide 2


' generation du terrain de jeu

3d_cube 400,1 :3d_position 400,0,0,25 :3d_hide 400
3D_x_scale 400,50 :3d_collision_as_faces 400
3d_cube 401,1 :3d_position 401,-25,0,0 :3d_hide 401
3d_z_scale 401,50 :3d_collision_as_faces 401
3d_cube 402,1 :3d_position 402,0,0,-25 :3d_hide 402
3D_x_scale 402,50 :3d_collision_as_faces 402
3d_cube 403,1 :3d_position 403,25,0,-14 :3d_hide 403
3d_z_scale 403,23 :3d_collision_as_faces 403
3d_cube 404,1 :3d_position 404,25,0,14 :3d_hide 404
3D_z_scale 404,23 :3d_collision_as_faces 404

3d_cube 405,1 :3d_position 405,0,0,10
3D_x_scale 405,21 :3d_collision_as_faces 405
3d_cube 406,1 :3d_position 406,-10,0,0
3d_z_scale 406,21 :3d_collision_as_faces 406
3d_cube 407,1 :3d_position 407,0,0,-10
3D_x_scale 407,21 :3d_collision_as_faces 407
3d_cube 408,1 :3d_position 408,10,0,-6
3d_z_scale 408,7.5 :3d_collision_as_faces 408
3d_cube 409,1 :3d_position 409,10,0,6
3D_z_scale 409,7.5 :3d_collision_as_faces 409


 ' création texte
3d_text 307,"pour sortir[esc]"
3d_y_rotate 307,180
3d_scale 307,4,4,4
3d_color 307,231,219,41
3d_x_position 307,5
3d_y_position 307,2
3d_z_position 307,40

3d_text 306,"pour avancer [TY]"
3d_y_rotate 306,180
3d_scale 306,4,4,4
3d_color 306,231,219,41
3d_x_position 306,10
3d_y_position 306,10
3d_z_position 306,40

3d_text 305,"pour reculer  [GH]"
3d_y_rotate 305,180
3d_scale 305,4,4,4
3d_color 305,231,219,41
3d_x_position 305,10
3d_y_position 305,6
3d_z_position 305,40

light_position -99,90,130
gosub vue

gosub minipelle
command_target_is 0



form 200 :left 200,700
caption 200,"poste de commande"
command_target_is 200
main_menu 51
sub_menu 52 : caption 52,"commande manuel" : parent 52,51
sub_menu 53 : caption 53,"programmation" : parent 53,51
sub_menu 54 : caption 54,"Ouvrir" : parent 54,52 :on_click 54,initm
rem sub_menu 55 : caption 55,"Sauver" : parent 55,52
sub_menu 56 : caption 56,"Quitter" : parent 56,52 : on_click 56,quit
rem sub_menu 57 : caption 57,"Creation" : parent 57,53
sub_menu 58 : caption 58,"lancement" : parent 58,53 : on_click 58,initauto
sub_menu 59 : caption 59,"quitter" : parent 59,53 : on_click 59,quit
alpha 103 : top 103, 20 : left 103,10 : caption 103, "utilisez votre pelle en manuel ou creez un programme"
alpha 104 : top 104, 35 : left 104,10 : caption 104, "commandes disponibles:                            "
alpha 105 : top 105, 50 : left 105,10 : caption 105, "QDSETYGHLOKM                                      "


timer 1 : timer_interval 1,15

end


'initialisation manu
initm:
on_key_down 0,bibliotheque_touche_1
on_key_up 0,bibliotheque_touche_2
moteur=1 :ok=1
on_timer 1,manuel
return

'initialisation auto
initauto:
3D_hide 307
3D_hide 306
3D_hide 305
hide 200
gosub prog
show 200:hide 52:command_target_is 200
caption 103, "vous pouvez relancez le programme                        "
caption 104,"                                                          "
caption 105,                                                            "

return

'creation du programme
programme:

return

'exemple de programme a executer
prog:
gosub init
rem for n=1 to 2
rem gosub creuse:gosub vide:t=20:s=-1:gosub translation:gosub vue
rem next n

for n=1 to 50
t=20:s=1:gosub translation
gosub test
next n

return


' creation du robot dumper
dumper:
3d_mesh 20
3d_load_object 20,"dumper.3ds"
3d_color 20,250,150,0
3d_position 20,0,1.1,20
3d_x_rotate 20,180
3d_scale 20,1.7,1.3,1.5
3d_collision_as_faces 20

return

' creation du robot minipelle
minipelle:
3d_mesh 5
3d_load_object 5,"chaine.3ds"
3d_collision_as_faces 5
3d_color 5,133,107,34


3d_mesh 6
3d_load_object 6,"chassi.3ds"
3d_chain 6,5
3d_color 6,250,150,0

3d_mesh 7
3d_load_object 7,"vitre.3ds"
3d_chain 7,6
3d_color 7,76,98,112

3d_mesh 8
3d_load_object 8,"bras1.3ds"
3d_chain 8,7
3d_color 8,250,150,0
3d_position 8,0,1.2,1.3

3d_mesh 9
3d_load_object 9,"bras2.3ds"
3d_chain 9,8
3d_color 9,250,150,0
3d_position 9,0,1.7,2

3d_mesh 10
3d_load_object 10,"godet.3ds"
3d_collision_as_faces 10
3d_chain 10,9
3d_color 10,86,76,47
3d_position 10,0,-1.1,0.9

3d_mesh 11
3d_load_object 11,"lame.3ds"
3d_collision_as_faces 11
3d_chain 11,5
3d_color 11,86,76,47
3d_position 11,0,0.5,1

3d_position 5,0,0,3
3d_y_rotate 5,140

gosub vue

rem sound 2 : file_load 2,"moteur.wav"
sound 7 : file_load 7,"klaxon.wav"

return

' utilisation direct des robots
manuel:
hide 200
rem    rem  delete 2
rem    rem  sound 2 : file_load 2,"moteur.wav"
rem if moteur=1
rem  play 2
  if touche_t+ touche_y=2 then 3d_move 5,0.05
  if touche_g=1 and touche_h=1 then 3d_move 5,(-0.05)
  if touche_t=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.6
  if touche_h=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.6
  if touche_y=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.6
  if touche_g=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.6
  if touche_q = 1 then 3d_y_rotate 6,o3d_y_rotate(6)+0.7
  if touche_d = 1 then 3d_y_rotate 6,o3d_y_rotate(6)-0.7
  if touche_e = 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
  if touche_s = 1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
  if touche_l = 1 and o3d_x_rotate(8) > -70 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
  if touche_o = 1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
  if touche_k = 1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
  if touche_m = 1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
  if touche_bas = 1 and o3d_x_rotate(11) > -5 then 3d_x_rotate 11,o3d_x_rotate(11)-0.13
  if touche_haut = 1 and o3d_x_rotate(11) < 8 then 3d_x_rotate 11,o3d_x_rotate(11)+0.13
rem end_if


if touche_espace = 1
  play 7
end_if
touche_espace = 0

if touche_echap = 1
timer_off 1

show 200:hide 54:rem command_target_is 200
caption 103, "vous pouvez lancer un programme de demonstration      "
caption 104,"                                                        "
caption 105,"                                                        "

end_if
point_position o3d_x_position(5),o3d_y_position(5),o3d_z_position(5)
return

'camera
vue:
cam_position o3d_x_position(1),o3d_y_position(1),o3d_z_position(1)
point_position o3d_x_position(2),o3d_y_position(2),o3d_z_position(2)
return
'tranduction non obligatoire mais j'y tiens
bibliotheque_touche_1:
if key_down_code = 68 then touche_d=1
if key_down_code = 69 then touche_e=1
if key_down_code = 71 then touche_g=1
if key_down_code = 72 then touche_h=1
if key_down_code = 75 then touche_k=1
if key_down_code = 76 then touche_l=1
if key_down_code = 77 then touche_m=1
if key_down_code = 79 then touche_o=1
if key_down_code = 81 then touche_q=1
if key_down_code = 83 then touche_s=1
if key_down_code = 84 then touche_t=1
if key_down_code = 89 then touche_y=1
if key_down_code = 27 then touche_echap=1
if key_down_code = 8 then touche_retour=1
if key_down_code = 13 then touche_enter=1
if key_down_code = 32 then touche_espace=1
if key_down_code = 38 then touche_haut=1
if key_down_code = 40 then touche_bas=1
return

bibliotheque_touche_2:
if key_up_code = 68 then touche_d=0
if key_up_code = 69 then touche_e=0
if key_up_code = 71 then touche_g=0
if key_up_code = 72 then touche_h=0
if key_up_code = 75 then touche_k=0
if key_up_code = 76 then touche_l=0
if key_up_code = 77 then touche_m=0
if key_up_code = 79 then touche_o=0
if key_up_code = 81 then touche_q=0
if key_up_code = 83 then touche_s=0
if key_up_code = 84 then touche_t=0
if key_up_code = 89 then touche_y=0
if key_up_code = 27 then touche_echap=0
if key_up_code = 8 then touche_retour=0
if key_up_code = 13 then touche_enter=0
if key_up_code = 38 then touche_haut=0
if key_up_code = 40 then touche_bas=0
return
'mise en pausition, de depart
init:
for i=1 to 250
if i>1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i>1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
if i>1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 4
next i
return

translation:
for i=1 to t
3d_move 5,s*(0.09 )
pause 10
gosub test
next i
return

rotation:
for i=1 to r
3d_y_rotate 5,o3d_y_rotate (5)+ s*(0.7)
pause 10
next i
return

tourne:
for i=1 to tou
3d_y_rotate 6,o3d_y_rotate (6)+(s*(0.7))
pause 10
next i
return
'creuse au sol a partir de la position init
creuse:
for i=1 to 300
 if i> 1 and o3d_x_rotate(8) > -40 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
 if i> 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
 if i>1 and o3d_x_rotate(10) < 10 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
 pause 5
next i
for i=1 to 50
 if i> 1 and o3d_x_rotate(8) > -50 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
 pause 5
next i
for i=1 to 50
if i> 1 and o3d_x_rotate(10) > -20 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
for i=1 to 200
if i> 1 and o3d_x_rotate(8) < -10 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i> 1 and o3d_x_rotate(9) > -10 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
if i>1 and o3d_x_rotate(10) > -90 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
return
'vide le godet en hauteur
vide:
for i=1 to 100
if i> 1 and o3d_x_rotate(8) < 20 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i> 1 and o3d_x_rotate(9) < 20 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
if i>1 and o3d_x_rotate(10) > -110 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
tou=180 : s=-1
gosub tourne
for i=1 to 200
if i> 1 and o3d_x_rotate(9) < 50 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
if i>1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
pause 5
next i
tou=180 : s=1
gosub tourne

return
'essai de test
test:
if o3d_collision (11,400) =1 then r=90:s=1:gosub rotation
if o3d_collision (11,401) =1 then r=50:s=2:gosub rotation
if o3d_collision (11,402) =1 then r=80:s=1:gosub rotation
if o3d_collision (11,403) =1 then r=70:s=2:gosub rotation
if o3d_collision (11,404) =1 then r=70:s=1:gosub rotation
if o3d_collision (11,405) =1 then r=90:s=1:gosub rotation
if o3d_collision (11,406) =1 then r=50:s=2:gosub rotation
if o3d_collision (11,407) =1 then r=80:s=1:gosub rotation
if o3d_collision (11,408) =1 then r=70:s=2:gosub rotation
if o3d_collision (11,409) =1 then r=70:s=1:gosub rotation
point_position o3d_x_position(5),o3d_y_position(5),o3d_z_position(5)
return

quit:
rem rem  delete 2
  delete 7
 3d_chain_break 6,5
 3d_chain_break 7,6
 3d_chain_break 8,7
 3d_chain_break 9,8
 3d_chain_break 10,9
 3d_chain_break 11,5
terminate
return

merci a jack pour son tuto
mindstorm
Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: un premier pas   robotique et Panoramic - Page 3 EmptySam 18 Mai 2013 - 16:05

bonjour a tous
comme c'est long d'ecrire un petit bout de code correct (fonctionnel)!!!
j'en profite pour mieux aprecier chacun de vos codes
je vous livre un debut de reponse , pour etre juste avec vous j'ai la solution mais j'ai buté trois semaines sur un for i=1 to 100 alors que repeat fait bien mieux Wink

Code:
dim touche_d,touche_e,touche_g,touche_h,touche_k,touche_l,touche_m,touche_o,touche_q,touche_s,touche_t,touche_y,
dim touche_echap,touche_retour,touche_enter,touche_espace,touche_haut,touche_bas
dim x2,x6,z2,z6,yr6,x3,y3,i,dxcam
dim moteur, son2 ,son7 ,ok,m
dim t,r,tou,cr,vi,te,s,n,l,lg,lt
dim g,gh$,gx$ ,f,fh$,fx$,fz$
dim l10,l11,l12,l13,l14,l15,l16,l17,l18,l19
dim l0,l1,l2,l3,l4,l5,l6,l7,l8,l9
dim n1,n2,n3,n4,n5,n6,n7
dim m1,m2,m3,m4,m5,m6,m7
dim droite,gauche,cotemur,lgmem
dim c1,c2,c3,c4,c5

label manuel , vue ,quit,prog ,minipelle,initm,initauto,dumper,programme
label bibliotheque_touche_1 , bibliotheque_touche_2
label translation,rotation,tourne,creuse,vide,test,init,testg,initg
moteur=0 : ok=0 :m4=0 :m2=0:m3=0
scene3d 99
full_space 0 :  full_space 99  : border_hide 0
color 99,0,0,200

3D_SKYBOX 3
3D_LOAD_TEXTURE_TOP 3,"skybox_top.jpg"
3D_LOAD_TEXTURE_LEFT 3,"bskybox_left.jpg"
3D_LOAD_TEXTURE_BACK 3,"bskybox_back.jpg"
3D_LOAD_TEXTURE_FRONT 3,"bskybox_front.jpg"
3D_LOAD_TEXTURE_RIGHT 3,"bskybox_right.jpg"

fog_on
fog_distance_min 5
fog_distance_max 700
fog_color 219,243,165

3d_plane 4
3d_scale 4,50,50,50
3d_x_rotate 4,90
3d_y_position 4,0
3d_load_texture 4,"herbe2.JPG"
3d_u_tile 4,400
3d_v_tile 4,400


3d_plane 14
3d_scale 14,5,5,1
3d_x_rotate 14,90
3d_y_position 14,0.02
 3d_color 14,89,75,18

3d_cube 1,1:3d_position 1,35,6,0
3d_cube 2,2 :3d_position 2,-20,-4,5: 3d_hide 2


' generation du terrain de jeu

3d_cube 400,1 :3d_position 400,0,0,25 :3d_hide 400
3D_x_scale 400,50 :3d_collision_as_faces 400
3d_cube 401,1 :3d_position 401,-25,0,0 :3d_hide 401
3d_z_scale 401,50 :3d_collision_as_faces 401
3d_cube 402,1 :3d_position 402,0,0,-25 :3d_hide 402
3D_x_scale 402,50 :3d_collision_as_faces 402
3d_cube 403,1 :3d_position 403,25,0,-14 :3d_hide 403
3d_z_scale 403,23 :3d_collision_as_faces 403
3d_cube 404,1 :3d_position 404,25,0,14 :3d_hide 404
3D_z_scale 404,23 :3d_collision_as_faces 404

3d_cube 405,1 :3d_position 405,0,0,10
3D_x_scale 405,21 :3d_collision_as_faces 405
3d_cube 406,1 :3d_position 406,-10,0,0
3d_z_scale 406,21 :3d_collision_as_faces 406
3d_cube 407,1 :3d_position 407,0,0,-10
3D_x_scale 407,21 :3d_collision_as_faces 407
3d_cube 408,1 :3d_position 408,10,0,-6
3d_z_scale 408,7.5 :3d_collision_as_faces 408
3d_cube 409,1 :3d_position 409,10,0,6
3D_z_scale 409,7.5 :3d_collision_as_faces 409


 ' création texte
3d_text 307,"pour sortir[esc]"
3d_y_rotate 307,180
3d_scale 307,4,4,4
3d_color 307,231,219,41
3d_x_position 307,5
3d_y_position 307,2
3d_z_position 307,40

3d_text 306,"pour avancer [TY]"
3d_y_rotate 306,180
3d_scale 306,4,4,4
3d_color 306,231,219,41
3d_x_position 306,10
3d_y_position 306,10
3d_z_position 306,40

3d_text 305,"pour reculer  [GH]"
3d_y_rotate 305,180
3d_scale 305,4,4,4
3d_color 305,231,219,41
3d_x_position 305,10
3d_y_position 305,6
3d_z_position 305,40

light_position -99,90,130
gosub vue

gosub minipelle
command_target_is 0



form 200 :left 200,700
caption 200,"poste de commande"
command_target_is 200
main_menu 51
sub_menu 52 : caption 52,"commande manuel" : parent 52,51
sub_menu 53 : caption 53,"programmation" : parent 53,51
sub_menu 54 : caption 54,"Ouvrir" : parent 54,52 :on_click 54,initm
rem sub_menu 55 : caption 55,"Sauver" : parent 55,52
sub_menu 56 : caption 56,"Quitter" : parent 56,52 : on_click 56,quit
rem sub_menu 57 : caption 57,"Creation" : parent 57,53
sub_menu 58 : caption 58,"lancement" : parent 58,53 : on_click 58,initauto
sub_menu 59 : caption 59,"quitter" : parent 59,53 : on_click 59,quit
alpha 103 : top 103, 20 : left 103,10 : caption 103, "utilisez votre pelle en manuel ou creez un programme"
alpha 104 : top 104, 35 : left 104,10 : caption 104, "commandes disponibles:                            "
alpha 105 : top 105, 50 : left 105,10 : caption 105, "QDSETYGHLOKM                                      "


timer 1 : timer_interval 1,15

end


'initialisation manu
initm:
on_key_down 0,bibliotheque_touche_1
on_key_up 0,bibliotheque_touche_2
moteur=1 :ok=1
on_timer 1,manuel
return

'initialisation auto
initauto:
3D_hide 307
3D_hide 306
3D_hide 305
hide 200
gosub prog
show 200:hide 52:command_target_is 200
caption 103, "vous pouvez relancez le programme                        "
caption 104,"                                                          "
caption 105,                                                            "

return

'creation du programme
programme:

return

'exemple de programme a executer
'exemple 1
rem for n=1 to 2
rem gosub creuse:gosub vide:t=20:s=-1:gosub translation:gosub vue
rem next n
'exemple 2
prog:

gosub init
gosub initg
m4=0
repeat
t=1:s=1
gosub translation
gosub test
gosub testg
if lg>0 then c1=1

if c1=1
 t=3:s=-1
 gosub translation

 for n1=1 to 45
  tou=1:s=1
  if lg>0  then s=0
  gosub tourne
  gosub test
  gosub testg
 next n1

 m3=m2
 tou=m2:s=-1
 gosub tourne

 for n2=1 to 45
  tou=1:s=-1
  if lg>0 then s=0
  gosub tourne
  gosub test
  gosub testg
 next n2

 m5=m2
 tou=0-m2:s=1
 gosub tourne
 m6=m3-m5

 if m6 >0 then cotemur=-1
 if m6 <0 then cotemur=1
 if m6=0 then cotemur=0
 if cotemur<0 then m4=1
 if cotemur>0 then m4=1
end_if
until m4=1
return


' creation du robot dumper
dumper:
3d_mesh 20
3d_load_object 20,"dumper.3ds"
3d_color 20,250,150,0
3d_position 20,0,1.1,20
3d_x_rotate 20,180
3d_scale 20,1.7,1.3,1.5
3d_collision_as_faces 20

return

' creation du robot minipelle
minipelle:
3d_mesh 5
3d_load_object 5,"chaine.3ds"
3d_collision_as_faces 5
3d_color 5,133,107,34


3d_mesh 6
3d_load_object 6,"chassi.3ds"
3d_chain 6,5
3d_color 6,250,150,0

3d_mesh 7
3d_load_object 7,"vitre.3ds"
3d_chain 7,6
3d_color 7,76,98,112

3d_mesh 8
3d_load_object 8,"bras1.3ds"
3d_chain 8,7
3d_color 8,250,150,0
3d_position 8,0,1.2,1.3

3d_mesh 9
3d_load_object 9,"bras2.3ds"
3d_chain 9,8
3d_color 9,250,150,0
3d_position 9,0,1.7,2

3d_mesh 10
3d_load_object 10,"godet.3ds"
3d_collision_as_faces 10
3d_chain 10,9
3d_color 10,86,76,47
3d_position 10,0,-1.1,0.9

3d_mesh 11
3d_load_object 11,"lame.3ds"
3d_collision_as_faces 11
3d_chain 11,5
3d_color 11,86,76,47
3d_position 11,0,0.5,1

3d_position 5,0,0,3
3d_y_rotate 5,140

gosub vue

rem sound 2 : file_load 2,"moteur.wav"
sound 7 : file_load 7,"klaxon.wav"

return

' utilisation direct des robots
manuel:
hide 200
rem    rem  delete 2
rem    rem  sound 2 : file_load 2,"moteur.wav"
rem if moteur=1
rem  play 2
  if touche_t+ touche_y=2 then 3d_move 5,0.05
  if touche_g=1 and touche_h=1 then 3d_move 5,(-0.05)
  if touche_t=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.6
  if touche_h=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.6
  if touche_y=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.6
  if touche_g=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.6
  if touche_q = 1 then 3d_y_rotate 6,o3d_y_rotate(6)+0.7
  if touche_d = 1 then 3d_y_rotate 6,o3d_y_rotate(6)-0.7
  if touche_e = 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
  if touche_s = 1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
  if touche_l = 1 and o3d_x_rotate(8) > -70 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
  if touche_o = 1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
  if touche_k = 1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
  if touche_m = 1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
  if touche_bas = 1 and o3d_x_rotate(11) > -5 then 3d_x_rotate 11,o3d_x_rotate(11)-0.13
  if touche_haut = 1 and o3d_x_rotate(11) < 8 then 3d_x_rotate 11,o3d_x_rotate(11)+0.13
rem end_if


if touche_espace = 1
  play 7
end_if
touche_espace = 0

if touche_echap = 1
timer_off 1

show 200:hide 54:rem command_target_is 200
caption 103, "vous pouvez lancer un programme de demonstration      "
caption 104,"                                                        "
caption 105,"                                                        "

end_if
point_position o3d_x_position(5),o3d_y_position(5),o3d_z_position(5)
return

'camera
vue:
cam_position o3d_x_position(1),o3d_y_position(1),o3d_z_position(1)
point_position o3d_x_position(2),o3d_y_position(2),o3d_z_position(2)
return
'tranduction non obligatoire mais j'y tiens
bibliotheque_touche_1:
if key_down_code = 68 then touche_d=1
if key_down_code = 69 then touche_e=1
if key_down_code = 71 then touche_g=1
if key_down_code = 72 then touche_h=1
if key_down_code = 75 then touche_k=1
if key_down_code = 76 then touche_l=1
if key_down_code = 77 then touche_m=1
if key_down_code = 79 then touche_o=1
if key_down_code = 81 then touche_q=1
if key_down_code = 83 then touche_s=1
if key_down_code = 84 then touche_t=1
if key_down_code = 89 then touche_y=1
if key_down_code = 27 then touche_echap=1
if key_down_code = 8 then touche_retour=1
if key_down_code = 13 then touche_enter=1
if key_down_code = 32 then touche_espace=1
if key_down_code = 38 then touche_haut=1
if key_down_code = 40 then touche_bas=1
return

bibliotheque_touche_2:
if key_up_code = 68 then touche_d=0
if key_up_code = 69 then touche_e=0
if key_up_code = 71 then touche_g=0
if key_up_code = 72 then touche_h=0
if key_up_code = 75 then touche_k=0
if key_up_code = 76 then touche_l=0
if key_up_code = 77 then touche_m=0
if key_up_code = 79 then touche_o=0
if key_up_code = 81 then touche_q=0
if key_up_code = 83 then touche_s=0
if key_up_code = 84 then touche_t=0
if key_up_code = 89 then touche_y=0
if key_up_code = 27 then touche_echap=0
if key_up_code = 8 then touche_retour=0
if key_up_code = 13 then touche_enter=0
if key_up_code = 38 then touche_haut=0
if key_up_code = 40 then touche_bas=0
return
'mise en pausition, de depart
init:
for i=1 to 250
if i>1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i>1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
if i>1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 4
next i
return
'mise en position de test godet
initg:
for i=1 to 250
if i>1 and o3d_x_rotate(8) >-26 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
if i>1 and o3d_x_rotate(9) <35 then 3d_x_rotate 9,o3d_x_rotate(9) +0.9
if i>1 and o3d_x_rotate(10) <-15 then 3d_x_rotate 10,o3d_x_rotate(10) +0.9
pause 4
next i
return


translation:
for i=1 to t
3d_move 5,s*(0.09 )
pause 5
next i
return

rotation:
for i=1 to r
3d_y_rotate 5,o3d_y_rotate (5)+ s*(1)
pause 5
next i
return

tourne:
for i=1 to tou
3d_y_rotate 6,o3d_y_rotate (6)+(s*(1))
pause 5
m2=m2+(1*s)

next i
return

'creuse au sol a partir de la position init
creuse:
for i=1 to 300
 if i> 1 and o3d_x_rotate(8) > -40 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
 if i> 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
 if i>1 and o3d_x_rotate(10) < 10 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
 pause 5
next i
for i=1 to 50
 if i> 1 and o3d_x_rotate(8) > -50 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
 pause 5
next i
for i=1 to 50
if i> 1 and o3d_x_rotate(10) > -20 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
for i=1 to 200
if i> 1 and o3d_x_rotate(8) < -10 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i> 1 and o3d_x_rotate(9) > -10 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
if i>1 and o3d_x_rotate(10) > -90 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
return
'vide le godet en hauteur
vide:
for i=1 to 100
if i> 1 and o3d_x_rotate(8) < 20 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i> 1 and o3d_x_rotate(9) < 20 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
if i>1 and o3d_x_rotate(10) > -110 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
tou=180 : s=-1
gosub tourne
for i=1 to 200
if i> 1 and o3d_x_rotate(9) < 50 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
if i>1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
pause 5
next i
tou=180 : s=1
gosub tourne

return
'essai de test
test:
l10 = o3d_collision (11,400)
l11 = o3d_collision (11,401)
l12 = o3d_collision (11,402)
l13 = o3d_collision (11,403)
l14 = o3d_collision (11,404)
l15 = o3d_collision (11,405)
l16 = o3d_collision (11,406)
l17 = o3d_collision (11,407)
l18 = o3d_collision (11,408)
l19 = o3d_collision (11,409)
l=l10+l11+l12+l13+l14+l15+l16+l17+l18+l19
point_position o3d_x_position(5),o3d_y_position(5),o3d_z_position(5)

return

testg:
l0 = o3d_collision (10,400)
l1 = o3d_collision (10,401)
l2 = o3d_collision (10,402)
l3 = o3d_collision (10,403)
l4 = o3d_collision (10,404)
l5 = o3d_collision (10,405)
l6 = o3d_collision (10,406)
l7 = o3d_collision (10,407)
l8 = o3d_collision (10,408)
l9 = o3d_collision (10,409)
lg =l0+l1+l2+l3+l4+l5+l6+l7+l8+l9
point_position o3d_x_position(5),o3d_y_position(5),o3d_z_position(5)

return


quit:
rem rem  delete 2
  delete 7
 3d_chain_break 6,5
 3d_chain_break 7,6
 3d_chain_break 8,7
 3d_chain_break 9,8
 3d_chain_break 10,9
 3d_chain_break 11,5
terminate
return


c'est le prix a payer pour apprendre sunny
il reste a coder la suite
a bientôt
Mindstorm


Dernière édition par mindstorm le Sam 18 Mai 2013 - 16:56, édité 1 fois
Revenir en haut Aller en bas
Jicehel

Jicehel


Nombre de messages : 5947
Age : 51
Localisation : 77500
Date d'inscription : 18/04/2011

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptySam 18 Mai 2013 - 16:32

Bon apprentissage et bon courage Wink
Revenir en haut Aller en bas
gigi75

gigi75


Nombre de messages : 101
Age : 51
Date d'inscription : 13/04/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptySam 18 Mai 2013 - 18:49

Désolé je ne suis pas souvent connecté, je pense à vous tout de même.

j'ai tout de même insité sur la fonction Grid, et j'ai fais ce code pour si certains veulent l'exploiter pour de la cartographie en robotique. Là je continue, je travaille pour inserer à chaque déplacement des meusures avec affichage des obstacles. Donc ce code est vide mais bien exploitable.

Code:

rem declaration des variables
 dim x,y,xr,yr,fin, difx, dify, calx, caly, i

rem chargement de la DLL
dll_on "wrapper_K8055d.dll"

rem position des variables
 xr=25
 yr=25

rem création de la fenêtre form0
 caption 0,"Robot Ver 1.0"
 height 0,768 : width 0,1290

rem création des affichages
 alpha 3 : top 3,30
 alpha 2 : top 2,50
 alpha 4

rem creation des labels
 label  clic, affichage, calcul

rem création de la grille
 grid 1 :left 1,550 :top 1,5
 height 1,710 : width 1,710: grid_column 1,50
 grid_column_width 1,13 : grid_row_height 1,13
 grid_row_fixed 1,1 : grid_column_fixed 1,1 :grid_row 1,50

rem commande boucle
 font_bold 1 : font_size 1,9 : font_color 1,255,0,0 : grid_write 1,xr,yr,"#"
 on_click 1,clic
 end

clic:
 x = grid_y_to_row(1,mouse_y_position(1))-1
 y = grid_x_to_column(1,mouse_x_position(1))-1
 caption 2,"Position X demandée : " + str$(x)+ "  Position Y demandée: "+ str$(y)
 caption 3,"Position X du robot : " + str$(xr-1)+ "  Position Y du robot : "+ str$(yr-1)
 goto calcul
 return

affichage:
 return

calcul:
 if x-xr >0
 difx = x-xr+1
 for i=1 to difx
 xr= xr+1
 grid_write 1,xr,yr,"#"
 grid_write 1,xr-1,yr," "
 caption 3,"Position X du robot : " + str$(xr-1)+ "  Position Y du robot : "+ str$(yr-1)
 wait 200
 next i
 else
 difx = abs(x-xr+1)
 for i=1 to abs (difx)
 xr= xr-1
 grid_write 1,xr,yr,"#"
 grid_write 1,xr+1,yr," "
 caption 3,"Position X du robot : " + str$(xr-1)+ "  Position Y du robot : "+ str$(yr-1)
 wait 200
 next i
 end_if
 
 if y-yr >0
 dify = y-yr+1
 for i=1 to dify
 yr= yr+1
 grid_write 1,xr,yr,"#"
 grid_write 1,xr,yr-1," "
 caption 3,"Position X du robot : " + str$(xr-1)+ "  Position Y du robot : "+ str$(yr-1)
 wait 200
 next i
 else
 dify = abs(y-yr+1)
 for i=1 to abs (dify)
 yr= yr-1
 grid_write 1,xr,yr,"#"
 grid_write 1,xr,yr+1," "
 wait 200
 caption 3,"Position X du robot : " + str$(xr-1)+ "  Position Y du robot : "+ str$(yr-1)
 next i
 end_if
 return

Gilles
Revenir en haut Aller en bas
gigi75

gigi75


Nombre de messages : 101
Age : 51
Date d'inscription : 13/04/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptySam 18 Mai 2013 - 22:33

Voilà le même programme avec les commandes moteur:
il avance, tourne à gauche, à droite, et le demi tour.

Je m'attaque à la detection maintenant

gilles

Code:

rem declaration des variables
 dim x,y,xr,yr,fin, difx, dify, calx, caly, i, detec, pas, resultat%, data1%
 dim data2%, tempo



rem chargement de la DLL
dll_on "wrapper_K8055d.dll"

rem reset digital et analogique
 data1% = dll_call1("K8055d_OpenDevice",data2%)
 resultat% = dll_call0("K8055d_ClearAllAnalog")
 resultat% = dll_call0("K8055d_ClearAllDigital")
 

rem position des variables
 xr=25
 yr=25
 pas = 5
 tempo = 200
rem création de la fenêtre form0
 caption 0,"Robot Ver 1.0"
 height 0,768 : width 0,1290

rem création des affichages
 alpha 3 : top 3,30
 alpha 2 : top 2,50
 alpha 4
 alpha 5 : top 5,70
 caption 2,"Position X demandée : "+ "0"+ "  Position Y demandée: "+ "0"
 caption 3,"Position X du robot : " +"25"+ "  Position Y du robot : "+ "25"



rem creation des labels
 label  clic, detection, calcul, moteur180, moteurd, moteurg

rem création de la grille
 grid 1 :left 1,550 :top 1,5
 height 1,710 : width 1,710: grid_column 1,50
 grid_column_width 1,13 : grid_row_height 1,13
 grid_row_fixed 1,1 : grid_column_fixed 1,1 :grid_row 1,50

rem commande boucle
 font_bold 1 : font_size 1,9 : font_color 1,255,0,0 : grid_write 1,xr,yr,"#"
 on_click 1,clic
 end

clic:
 x = grid_y_to_row(1,mouse_y_position(1))-1
 y = grid_x_to_column(1,mouse_x_position(1))-1
 caption 2,"Position X demandée : " + str$(x)+ "  Position Y demandée: "+ str$(y)
 caption 3,"Position X du robot : " + str$(xr-1)+ "  Position Y du robot : "+ str$(yr-1)
 goto calcul
 return

detection:






 return

calcul:
 if x-xr >0
 gosub moteur180
 difx = x-xr+1
 for i=1 to difx
 xr= xr+1
 grid_write 1,xr,yr,"#"
 grid_write 1,xr-1,yr," "
 resultat% = dll_call1("K8055d_SetDigitalChannel",1)
 caption 3,"Position X du robot : " + str$(xr-1)+ "  Position Y du robot : "+ str$(yr-1)
 wait tempo
 next i
 else
 difx = abs(x-xr+1)
 for i=1 to abs (difx)
 xr= xr-1
 grid_write 1,xr,yr,"#"
 grid_write 1,xr+1,yr," "
 resultat% = dll_call1("K8055d_SetDigitalChannel",1)
 caption 3,"Position X du robot : " + str$(xr-1)+ "  Position Y du robot : "+ str$(yr-1)
 wait tempo
 next i
 end_if
 resultat% = dll_call0("K8055d_ClearAllDigital")
 if y-yr >0
 gosub moteurd
 dify = y-yr+1
 for i=1 to dify
 yr= yr+1
 grid_write 1,xr,yr,"#"
 grid_write 1,xr,yr-1," "
 resultat% = dll_call1("K8055d_SetDigitalChannel",1)
 caption 3,"Position X du robot : " + str$(xr-1)+ "  Position Y du robot : "+ str$(yr-1)
 wait tempo
 next i
 else
 gosub moteurg
 dify = abs(y-yr+1)
 for i=1 to abs (dify)
 yr= yr-1
 grid_write 1,xr,yr,"#"
 grid_write 1,xr,yr+1," "
 resultat% = dll_call1("K8055d_SetDigitalChannel",1)
 wait tempo
 caption 3,"Position X du robot : " + str$(xr-1)+ "  Position Y du robot : "+ str$(yr-1)
 next i
 end_if
 resultat% = dll_call0("K8055d_ClearAllDigital")
 return


rem tourne de 180°par la gauche
moteur180:
 resultat% = dll_call0("K8055d_ClearAllAnalog")
 resultat% = dll_call0("K8055d_ClearAllDigital")
 for i=1 to 1000
 resultat% = dll_call1("K8055d_SetDigitalChannel",4)
 next i
 resultat% = dll_call0("K8055d_ClearAllAnalog")
 resultat% = dll_call0("K8055d_ClearAllDigital")
return

rem tourne de 90° à droite
moteurd:
 resultat% = dll_call0("K8055d_ClearAllAnalog")
 resultat% = dll_call0("K8055d_ClearAllDigital")
 for i=1 to 500
 resultat% = dll_call1("K8055d_SetDigitalChannel",3)
 next i
 resultat% = dll_call0("K8055d_ClearAllAnalog")
 resultat% = dll_call0("K8055d_ClearAllDigital")
return

rem tourne de 90° à gauche
moteurg:
 resultat% = dll_call0("K8055d_ClearAllAnalog")
 resultat% = dll_call0("K8055d_ClearAllDigital")
 for i=1 to 500
 resultat% = dll_call1("K8055d_SetDigitalChannel",4)
 next i
 resultat% = dll_call0("K8055d_ClearAllAnalog")
 resultat% = dll_call0("K8055d_ClearAllDigital")
return

Par contre il incremente une case je ne sais pas ou.

Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyDim 19 Mai 2013 - 9:00

Bonjour a tous
et metci gigi pour tes recherches
@tous et toute
comme moi debutant en forum
tapez bbcode sur votre moteur de recherche (merci papydall)
Mindstorm
Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyJeu 30 Mai 2013 - 21:13

bonsoir a tous
aller, j'ai refait un bout de code (deux jours pour moi avec un probleme de negation qui se promenait)
Code:
dim touche_d,touche_e,touche_g,touche_h,touche_k,touche_l,touche_m,touche_o,touche_q,touche_s,touche_t,touche_y,
dim touche_echap,touche_retour,touche_enter,touche_espace,touche_haut,touche_bas
dim x2,x6,z2,z6,yr6,x3,y3,i,dxcam
dim moteur, son2 ,son7 ,ok,m
dim t,r,tou,cr,vi,te,s,n,l,lg,lt
dim g,gh$,gx$ ,f,fh$,fx$,fz$
dim l10,l11,l12,l13,l14,l15,l16,l17,l18,l19
dim l0,l1,l2,l3,l4,l5,l6,l7,l8,l9
dim n1,n2,n3,n4,n5,n6,n7
dim m1,m2,m3,m4,m5,m6,m7
dim droite,gauche,cotemur,lgmem
dim c1,c2,c3,c4,c5

label manuel , vue ,quit,prog ,minipelle,initm,initauto,dumper,programme
label bibliotheque_touche_1 , bibliotheque_touche_2
label translation,rotation,tourne,creuse,vide,test,init,testg,initg
moteur=0 : ok=0 :m4=0 :m2=0:m3=0
scene3d 99
full_space 0 :  full_space 99  : border_hide 0
color 99,0,0,200

3D_SKYBOX 3
3D_LOAD_TEXTURE_TOP 3,"skybox_top.jpg"
3D_LOAD_TEXTURE_LEFT 3,"bskybox_left.jpg"
3D_LOAD_TEXTURE_BACK 3,"bskybox_back.jpg"
3D_LOAD_TEXTURE_FRONT 3,"bskybox_front.jpg"
3D_LOAD_TEXTURE_RIGHT 3,"bskybox_right.jpg"

fog_on
fog_distance_min 5
fog_distance_max 700
fog_color 219,243,165

3d_plane 4
3d_scale 4,50,50,50
3d_x_rotate 4,90
3d_y_position 4,0
3d_load_texture 4,"herbe2.JPG"
3d_u_tile 4,400
3d_v_tile 4,400


3d_plane 14
3d_scale 14,5,5,1
3d_x_rotate 14,90
3d_y_position 14,0.02
 3d_color 14,89,75,18

3d_cube 1,1:3d_position 1,35,6,0
3d_cube 2,2 :3d_position 2,-20,-4,5: 3d_hide 2


' generation du terrain de jeu

3d_cube 400,1 :3d_position 400,0,0,25 :3d_hide 400
3D_x_scale 400,50 :3d_collision_as_faces 400
3d_cube 401,1 :3d_position 401,-25,0,0 :3d_hide 401
3d_z_scale 401,50 :3d_collision_as_faces 401
3d_cube 402,1 :3d_position 402,0,0,-25 :3d_hide 402
3D_x_scale 402,50 :3d_collision_as_faces 402
3d_cube 403,1 :3d_position 403,25,0,-14 :3d_hide 403
3d_z_scale 403,23 :3d_collision_as_faces 403
3d_cube 404,1 :3d_position 404,25,0,14 :3d_hide 404
3D_z_scale 404,23 :3d_collision_as_faces 404

3d_cube 405,1 :3d_position 405,0,0,10
3D_x_scale 405,21 :3d_collision_as_faces 405
3d_cube 406,1 :3d_position 406,-10,0,0
3d_z_scale 406,21 :3d_collision_as_faces 406
3d_cube 407,1 :3d_position 407,0,0,-10
3D_x_scale 407,21 :3d_collision_as_faces 407
3d_cube 408,1 :3d_position 408,10,0,-6
3d_z_scale 408,7.5 :3d_collision_as_faces 408
3d_cube 409,1 :3d_position 409,10,0,6
3D_z_scale 409,7.5 :3d_collision_as_faces 409


 ' création texte
3d_text 307,"pour sortir[esc]"
3d_y_rotate 307,180
3d_scale 307,4,4,4
3d_color 307,231,219,41
3d_x_position 307,5
3d_y_position 307,2
3d_z_position 307,40

3d_text 306,"pour avancer [TY]"
3d_y_rotate 306,180
3d_scale 306,4,4,4
3d_color 306,231,219,41
3d_x_position 306,10
3d_y_position 306,10
3d_z_position 306,40

3d_text 305,"pour reculer  [GH]"
3d_y_rotate 305,180
3d_scale 305,4,4,4
3d_color 305,231,219,41
3d_x_position 305,10
3d_y_position 305,6
3d_z_position 305,40

light_position -99,90,130
gosub vue

gosub minipelle
command_target_is 0



form 200 :left 200,700
caption 200,"poste de commande"
command_target_is 200
main_menu 51
sub_menu 52 : caption 52,"commande manuel" : parent 52,51
sub_menu 53 : caption 53,"programmation" : parent 53,51
sub_menu 54 : caption 54,"Ouvrir" : parent 54,52 :on_click 54,initm
rem sub_menu 55 : caption 55,"Sauver" : parent 55,52
sub_menu 56 : caption 56,"Quitter" : parent 56,52 : on_click 56,quit
rem sub_menu 57 : caption 57,"Creation" : parent 57,53
sub_menu 58 : caption 58,"lancement" : parent 58,53 : on_click 58,initauto
sub_menu 59 : caption 59,"quitter" : parent 59,53 : on_click 59,quit
alpha 103 : top 103, 20 : left 103,10 : caption 103, "utilisez votre pelle en manuel ou creez un programme"
alpha 104 : top 104, 35 : left 104,10 : caption 104, "commandes disponibles:                            "
alpha 105 : top 105, 50 : left 105,10 : caption 105, "QDSETYGHLOKM                                      "


timer 1 : timer_interval 1,15

end


'initialisation manu
initm:
on_key_down 0,bibliotheque_touche_1
on_key_up 0,bibliotheque_touche_2
moteur=1 :ok=1
on_timer 1,manuel
return

'initialisation auto
initauto:
3D_hide 307
3D_hide 306
3D_hide 305
hide 200
gosub prog
show 200:hide 52:command_target_is 200
caption 103, "vous pouvez relancez le programme                        "
caption 104,"                                                          "
caption 105,                                                            "

return

'creation du programme
programme:

return

'exemple de programme a executer
'exemple 1
rem for n=1 to 2
rem gosub creuse:gosub vide:t=20:s=-1:gosub translation:gosub vue
rem next n
'exemple 2
prog:

gosub init
gosub initg
m4=0
repeat
t=1:s=1
gosub translation
gosub test
gosub testg
if lg>0 then c1=1

if c1=1
 t=3:s=-1
 gosub translation

 for n1=1 to 45
  tou=1:s=1
  if lg>0  then s=0
  gosub tourne
  gosub test
  gosub testg
 next n1

 m3=m2
 tou=m2:s=-1
 gosub tourne

 for n2=1 to 45
  tou=1:s=-1
  if lg>0 then s=0
  gosub tourne
  gosub test
  gosub testg
 next n2

 m5=m2
 tou=0-m2:s=1
 gosub tourne
 m6=m3+m5

 if m6 >0 then cotemur=1
 if m6 <0 then cotemur=(0-1)
 if m6=0 then cotemur=0
 if cotemur<0 then m4=1
 if cotemur>0 then m4=1
end_if
until m4=1


repeat
r=5:s=cotemur
gosub rotation
repeat
t=1:s=1
gosub translation
gosub test
gosub testg
until lg>0 or l>0
until l>0

t=1:s=-1
gosub translation

for n1=1 to 270
  tou=1:s=cotemur
 if lg>0 then s=0
  gosub tourne
  gosub test
  gosub testg
 next n1
m2=m2*cotemur
 m3=m2-180
 tou=m2:s=(0-cotemur)
 gosub tourne
 
 m6=m3*0.5
r=m6:s=cotemur
gosub rotation


return


' creation du robot dumper
dumper:
3d_mesh 20
3d_load_object 20,"dumper.3ds"
3d_color 20,250,150,0
3d_position 20,0,1.1,20
3d_x_rotate 20,180
3d_scale 20,1.7,1.3,1.5
3d_collision_as_faces 20

return

' creation du robot minipelle
minipelle:
3d_mesh 5
3d_load_object 5,"chaine.3ds"
3d_collision_as_faces 5
3d_color 5,133,107,34


3d_mesh 6
3d_load_object 6,"chassi.3ds"
3d_chain 6,5
3d_color 6,250,150,0

3d_mesh 7
3d_load_object 7,"vitre.3ds"
3d_chain 7,6
3d_color 7,76,98,112

3d_mesh 8
3d_load_object 8,"bras1.3ds"
3d_chain 8,7
3d_color 8,250,150,0
3d_position 8,0,1.2,1.3

3d_mesh 9
3d_load_object 9,"bras2.3ds"
3d_chain 9,8
3d_color 9,250,150,0
3d_position 9,0,1.7,2

3d_mesh 10
3d_load_object 10,"godet.3ds"
3d_collision_as_faces 10
3d_chain 10,9
3d_color 10,86,76,47
3d_position 10,0,-1.1,0.9

3d_mesh 11
3d_load_object 11,"lame.3ds"
3d_collision_as_faces 11
3d_chain 11,5
3d_color 11,86,76,47
3d_position 11,0,0.5,1

3d_position 5,0,0,3
3d_y_rotate 5,140

gosub vue

rem sound 2 : file_load 2,"moteur.wav"
sound 7 : file_load 7,"klaxon.wav"

return

' utilisation direct des robots
manuel:
hide 200
rem    rem  delete 2
rem    rem  sound 2 : file_load 2,"moteur.wav"
rem if moteur=1
rem  play 2
  if touche_t+ touche_y=2 then 3d_move 5,0.05
  if touche_g=1 and touche_h=1 then 3d_move 5,(-0.05)
  if touche_t=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.6
  if touche_h=1  then 3d_y_rotate 5,o3d_y_rotate(5)-0.6
  if touche_y=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.6
  if touche_g=1  then 3d_y_rotate 5,o3d_y_rotate(5)+0.6
  if touche_q = 1 then 3d_y_rotate 6,o3d_y_rotate(6)+0.7
  if touche_d = 1 then 3d_y_rotate 6,o3d_y_rotate(6)-0.7
  if touche_e = 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
  if touche_s = 1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
  if touche_l = 1 and o3d_x_rotate(8) > -70 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
  if touche_o = 1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
  if touche_k = 1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
  if touche_m = 1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
  if touche_bas = 1 and o3d_x_rotate(11) > -5 then 3d_x_rotate 11,o3d_x_rotate(11)-0.13
  if touche_haut = 1 and o3d_x_rotate(11) < 8 then 3d_x_rotate 11,o3d_x_rotate(11)+0.13
rem end_if


if touche_espace = 1
  play 7
end_if
touche_espace = 0

if touche_echap = 1
timer_off 1

show 200:hide 54:rem command_target_is 200
caption 103, "vous pouvez lancer un programme de demonstration      "
caption 104,"                                                        "
caption 105,"                                                        "

end_if
point_position o3d_x_position(5),o3d_y_position(5),o3d_z_position(5)
return

'camera
vue:
cam_position o3d_x_position(1),o3d_y_position(1),o3d_z_position(1)
point_position o3d_x_position(2),o3d_y_position(2),o3d_z_position(2)
return
'tranduction non obligatoire mais j'y tiens
bibliotheque_touche_1:
if key_down_code = 68 then touche_d=1
if key_down_code = 69 then touche_e=1
if key_down_code = 71 then touche_g=1
if key_down_code = 72 then touche_h=1
if key_down_code = 75 then touche_k=1
if key_down_code = 76 then touche_l=1
if key_down_code = 77 then touche_m=1
if key_down_code = 79 then touche_o=1
if key_down_code = 81 then touche_q=1
if key_down_code = 83 then touche_s=1
if key_down_code = 84 then touche_t=1
if key_down_code = 89 then touche_y=1
if key_down_code = 27 then touche_echap=1
if key_down_code = 8 then touche_retour=1
if key_down_code = 13 then touche_enter=1
if key_down_code = 32 then touche_espace=1
if key_down_code = 38 then touche_haut=1
if key_down_code = 40 then touche_bas=1
return

bibliotheque_touche_2:
if key_up_code = 68 then touche_d=0
if key_up_code = 69 then touche_e=0
if key_up_code = 71 then touche_g=0
if key_up_code = 72 then touche_h=0
if key_up_code = 75 then touche_k=0
if key_up_code = 76 then touche_l=0
if key_up_code = 77 then touche_m=0
if key_up_code = 79 then touche_o=0
if key_up_code = 81 then touche_q=0
if key_up_code = 83 then touche_s=0
if key_up_code = 84 then touche_t=0
if key_up_code = 89 then touche_y=0
if key_up_code = 27 then touche_echap=0
if key_up_code = 8 then touche_retour=0
if key_up_code = 13 then touche_enter=0
if key_up_code = 38 then touche_haut=0
if key_up_code = 40 then touche_bas=0
return
'mise en pausition, de depart
init:
for i=1 to 250
if i>1 and o3d_x_rotate(8) < 32 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i>1 and o3d_x_rotate(9) > -35 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
if i>1 and o3d_x_rotate(10) > -120 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 4
next i
return
'mise en position de test godet
initg:
for i=1 to 250
if i>1 and o3d_x_rotate(8) >-26 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
if i>1 and o3d_x_rotate(9) <35 then 3d_x_rotate 9,o3d_x_rotate(9) +0.9
if i>1 and o3d_x_rotate(10) <-15 then 3d_x_rotate 10,o3d_x_rotate(10) +0.9
pause 4
next i
return


translation:
for i=1 to t
3d_move 5,s*(0.09 )
pause 5
next i
return

rotation:
for i=1 to r
3d_y_rotate 5,o3d_y_rotate (5)+ (s*(1))
pause 5
next i
return

tourne:
for i=1 to tou
3d_y_rotate 6,o3d_y_rotate (6)+(s*(1))
pause 5
m2=m2+(1*s)

next i
return

'creuse au sol a partir de la position init
creuse:
for i=1 to 300
 if i> 1 and o3d_x_rotate(8) > -40 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
 if i> 1 and o3d_x_rotate(9) < 80 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
 if i>1 and o3d_x_rotate(10) < 10 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
 pause 5
next i
for i=1 to 50
 if i> 1 and o3d_x_rotate(8) > -50 then 3d_x_rotate 8,o3d_x_rotate(8)-0.5
 pause 5
next i
for i=1 to 50
if i> 1 and o3d_x_rotate(10) > -20 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
for i=1 to 200
if i> 1 and o3d_x_rotate(8) < -10 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i> 1 and o3d_x_rotate(9) > -10 then 3d_x_rotate 9,o3d_x_rotate(9)-0.9
if i>1 and o3d_x_rotate(10) > -90 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
return
'vide le godet en hauteur
vide:
for i=1 to 100
if i> 1 and o3d_x_rotate(8) < 20 then 3d_x_rotate 8,o3d_x_rotate(8)+0.5
if i> 1 and o3d_x_rotate(9) < 20 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
if i>1 and o3d_x_rotate(10) > -110 then 3d_x_rotate 10,o3d_x_rotate(10)-0.9
pause 5
next i
tou=180 : s=-1
gosub tourne
for i=1 to 200
if i> 1 and o3d_x_rotate(9) < 50 then 3d_x_rotate 9,o3d_x_rotate(9)+0.9
if i>1 and o3d_x_rotate(10) < 80 then 3d_x_rotate 10,o3d_x_rotate(10)+0.9
pause 5
next i
tou=180 : s=1
gosub tourne

return
'essai de test
test:
l10 = o3d_collision (11,400)
l11 = o3d_collision (11,401)
l12 = o3d_collision (11,402)
l13 = o3d_collision (11,403)
l14 = o3d_collision (11,404)
l15 = o3d_collision (11,405)
l16 = o3d_collision (11,406)
l17 = o3d_collision (11,407)
l18 = o3d_collision (11,408)
l19 = o3d_collision (11,409)
l=l10+l11+l12+l13+l14+l15+l16+l17+l18+l19
point_position o3d_x_position(5),o3d_y_position(5),o3d_z_position(5)

return

testg:
l0 = o3d_collision (10,400)
l1 = o3d_collision (10,401)
l2 = o3d_collision (10,402)
l3 = o3d_collision (10,403)
l4 = o3d_collision (10,404)
l5 = o3d_collision (10,405)
l6 = o3d_collision (10,406)
l7 = o3d_collision (10,407)
l8 = o3d_collision (10,408)
l9 = o3d_collision (10,409)
lg =l0+l1+l2+l3+l4+l5+l6+l7+l8+l9
point_position o3d_x_position(5),o3d_y_position(5),o3d_z_position(5)

return


quit:
rem rem  delete 2
  delete 7
 3d_chain_break 6,5
 3d_chain_break 7,6
 3d_chain_break 8,7
 3d_chain_break 9,8
 3d_chain_break 10,9
 3d_chain_break 11,5
terminate
return
maintenant il arrive a se mettre parallele a la cloison quelque soit la position de depart.Essayez!
il ne reste plus qu a chercher la sortie
mindstorm sunny
Revenir en haut Aller en bas
Jicehel

Jicehel


Nombre de messages : 5947
Age : 51
Localisation : 77500
Date d'inscription : 18/04/2011

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyJeu 30 Mai 2013 - 21:55

Pas mal
Revenir en haut Aller en bas
mindstorm

mindstorm


Nombre de messages : 685
Age : 55
Localisation : charente
Date d'inscription : 13/02/2013

robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 EmptyJeu 30 Mai 2013 - 22:23

MERCI
mes bêtes noir ont toujours été les + et -
et là il y en a a chaque ligne pale
mindstorm
Revenir en haut Aller en bas
Contenu sponsorisé





robotique et Panoramic - Page 3 Empty
MessageSujet: Re: robotique et Panoramic   robotique et Panoramic - Page 3 Empty

Revenir en haut Aller en bas
 
robotique et Panoramic
Revenir en haut 
Page 3 sur 5Aller à la page : Précédent  1, 2, 3, 4, 5  Suivant
 Sujets similaires
-
» Logithèque : une base de données en Panoramic pour Panoramic
» IDE Panoramic écrit en Panoramic
» PANORAMIC V 0.9.6 available / PANORAMIC V 0.9.6 disponible
» Logo Panoramic en Panoramic
» PANORAMIC V 0.9.20

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC :: PANORAMIC :: Vos projets-
Sauter vers: