
Time is good
Fork of Robot2016_2-0 by
Map/Objectif/objectif.cpp@64:24e1057a97f7, 2016-05-05 (annotated)
- Committer:
- IceTeam
- Date:
- Thu May 05 01:30:14 2016 +0200
- Revision:
- 64:24e1057a97f7
- Parent:
- 63:176d04975f06
- Child:
- 66:47353c8122de
Test du code d'execution des objectifs et des nouvelles fonctionnalites du path finding
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
IceTeam | 57:86f491f5b25d | 1 | #include "objectif.h" |
IceTeam | 57:86f491f5b25d | 2 | |
IceTeam | 64:24e1057a97f7 | 3 | /* Dernier Changement : Romain 0h20 */ |
IceTeam | 57:86f491f5b25d | 4 | |
IceTeam | 64:24e1057a97f7 | 5 | objectif::objectif (int ntype, float nx_obj, float ny_obj, float nthet_obj, Odometry * nCodo, AX12 * np, ControlleurPince * npince) { |
IceTeam | 60:8d2320a54a32 | 6 | Parasol = np; |
IceTeam | 60:8d2320a54a32 | 7 | pince = npince; |
IceTeam | 60:8d2320a54a32 | 8 | type = ntype; |
IceTeam | 60:8d2320a54a32 | 9 | x_objectif = nx_obj; |
IceTeam | 60:8d2320a54a32 | 10 | y_objectif = ny_obj; |
IceTeam | 60:8d2320a54a32 | 11 | thet_objectif = nthet_obj; |
IceTeam | 64:24e1057a97f7 | 12 | Codo = nCode; |
IceTeam | 64:24e1057a97f7 | 13 | marche_arrière = arr; |
IceTeam | 60:8d2320a54a32 | 14 | } |
IceTeam | 62:80a81e4ad9f8 | 15 | |
IceTeam | 62:80a81e4ad9f8 | 16 | bool objectif::Action () { |
IceTeam | 57:86f491f5b25d | 17 | switch(type) { |
IceTeam | 57:86f491f5b25d | 18 | case OBJ_BLOC: |
IceTeam | 60:8d2320a54a32 | 19 | return obj_bloc_action(); |
IceTeam | 60:8d2320a54a32 | 20 | break; |
IceTeam | 60:8d2320a54a32 | 21 | case OBJ_PARA: |
IceTeam | 60:8d2320a54a32 | 22 | return obj_para_action(); |
IceTeam | 60:8d2320a54a32 | 23 | break; |
IceTeam | 57:86f491f5b25d | 24 | default: |
IceTeam | 60:8d2320a54a32 | 25 | break; |
IceTeam | 57:86f491f5b25d | 26 | } |
IceTeam | 64:24e1057a97f7 | 27 | |
IceTeam | 64:24e1057a97f7 | 28 | if (marche_arrière != 0) { |
IceTeam | 64:24e1057a97f7 | 29 | odo->GotoDist(-marche_arrière); |
IceTeam | 64:24e1057a97f7 | 30 | } |
IceTeam | 60:8d2320a54a32 | 31 | } |
IceTeam | 60:8d2320a54a32 | 32 | |
IceTeam | 62:80a81e4ad9f8 | 33 | bool objectif::obj_bloc_action () { |
IceTeam | 64:24e1057a97f7 | 34 | /* Range : 0 -> 10 (cm). pince.home remet à 0 */ |
IceTeam | 64:24e1057a97f7 | 35 | pince.home(); |
IceTeam | 64:24e1057a97f7 | 36 | pince.setPos(3); |
IceTeam | 60:8d2320a54a32 | 37 | } |
IceTeam | 60:8d2320a54a32 | 38 | |
IceTeam | 63:176d04975f06 | 39 | bool objectif::obj_para_action() { |
IceTeam | 57:86f491f5b25d | 40 | return true; |
IceTeam | 57:86f491f5b25d | 41 | } |