Follow() and MoveWaypoint() first tests

This commit is contained in:
Pascal Brisset
2005-11-05 18:13:19 +00:00
parent f94462d6da
commit cb552d58b2
7 changed files with 49 additions and 30 deletions
+2 -1
View File
@@ -62,7 +62,8 @@ $(TARGET).srcs = \
if_calib.c \
mainloop.c \
cam.c \
traffic_info.c
traffic_info.c \
datalink.c
ifeq ($(AIRCRAFT), Gorazoptere_brushless_ANALOG)
$(TARGET).srcs += ahrs.S
-3
View File
@@ -133,9 +133,6 @@ void parse_gps_msg( void ) {
}
}
#endif
}
+5
View File
@@ -40,6 +40,7 @@
#include "estimator.h"
#include "downlink.h"
#include "uart.h"
#include "datalink.h"
#ifdef SECTION_IMU_ANALOG
#include "ahrs.h"
@@ -112,6 +113,10 @@ int main( void ) {
gps_pos_available = FALSE;
}
}
if (dl_msg_available) {
dl_parse_msg();
dl_msg_available = FALSE;
}
if (link_fbw_receive_complete) {
/* receive radio control task from fbw */
link_fbw_receive_complete = FALSE;
+3 -2
View File
@@ -167,10 +167,10 @@ static float qdr;
#define Qdr(x) (Min(x, 350) < qdr && qdr < x+10)
#define Follow(_ac_id, _distance) { \
struct ac_info_ * ac = get_the_other(_ac_id); \
struct ac_info_ * ac = get_ac_info(_ac_id); \
vertical_mode = VERTICAL_MODE_AUTO_ALT; \
desired_altitude = ac->alt; \
float alpha = M_PI/2 - RadOfDeg(ac->heading); \
float alpha = M_PI/2 - ac->course; \
fly_to_xy(ac->east - _distance*cos(alpha), ac->north - _distance*sin(alpha)); \
}
@@ -197,6 +197,7 @@ const uint8_t nb_waypoint = NB_WAYPOINT;
struct point waypoints[NB_WAYPOINT+1] = WAYPOINTS;
/** distance of carrot (in meter) */
static float carrot;
+10
View File
@@ -78,4 +78,14 @@ void nav_home(void);
void nav_init(void);
void nav_without_gps(void);
#define MoveWaypoint(_id, _ux, _uy, _a) { \
if (_id < nb_waypoint) { \
waypoints[_id].x = _ux - nav_utm_east0; \
waypoints[_id].y = _uy - nav_utm_north0; \
waypoints[_id].a = _a; \
/*** printf("%d:x=%.0f y=%.0f a=%.0f\n",_id, waypoints[_id].x, waypoints[_id].y, _a); ***/ \
} \
}
#endif /* NAV_H */
+5 -20
View File
@@ -21,31 +21,16 @@
* Boston, MA 02111-1307, USA.
*
*/
/** \file nav.c
/** \file traffic_info.c
* \brief Informations relative to the other aircrafts
*
*/
#include <inttypes.h>
#include "flight_plan.h"
#include "traffic_info.h"
#define NB_OTHERS 4
struct ac_info_ {float east, north, heading, alt;};
struct ac_info_ the_others[NB_OTHERS];
void
set_the_other(uint8_t id, float utm_x, float utm_y, float heading, float alt) {
if (id < NB_OTHERS) {
the_others[id].east = utm_x - NAV_UTM_EAST0;
the_others[id].north = utm_y - NAV_UTM_NORTH0;
the_others[id].heading = heading;
the_others[id].alt = alt;
}
}
struct ac_info_ * get_the_other(uint8_t id) {
id = (id < NB_OTHERS ? id : NB_OTHERS - 1);
return &the_others[id];
struct ac_info_ * get_ac_info(uint8_t id) {
id = (id < NB_ACS ? id : 0);
return &the_acs[id];
}
+24 -4
View File
@@ -29,12 +29,32 @@
#ifndef TI_H
#define TI_H
struct ac_info_ {float east, north, heading, alt;};
#define NB_ACS 4
struct ac_info_ {
float east; /* m */
float north; /* m */
float course; /* rad (CW) */
float alt; /* m */
float gspeed; /* m/s */
};
struct ac_info_ the_acs[NB_ACS];
#define SetAcInfo(_id, _utm_x /*m*/, _utm_y /*m*/, _course/*rad(CW)*/, _alt/*m*/,_gspeed/*m/s*/) { \
if (_id < NB_ACS) { \
the_acs[_id].east = _utm_x - NAV_UTM_EAST0; \
the_acs[_id].north = _utm_y - NAV_UTM_NORTH0; \
the_acs[_id].course = _course; \
the_acs[_id].alt = _alt; \
the_acs[_id].gspeed = _gspeed; \
/*** printf("%d:x=%.0f y=%.0f c=%f a=%.0f\n",_id,the_acs[_id].east,the_acs[_id].north,the_acs[_id].course, the_acs[_id].alt); ***/ \
} \
}
void
set_the_other(uint8_t id, float utm_x, float utm_y, float heading, float alt);
struct ac_info_ *
get_the_other(uint8_t id);
get_ac_info(uint8_t id);
#endif