1
0
Fork 0

Added autopilot target values to communications link.

Pass autopilot target values to LFSGlass display so they can be properly
displayed.
Fix a gps status display bug.
This commit is contained in:
curt 2008-04-04 06:15:05 +00:00
parent 7783e64953
commit fe41d33b4c
2 changed files with 23 additions and 14 deletions

View file

@ -46,7 +46,7 @@ struct gps {
double lat,lon,alt; /* gps position */ double lat,lon,alt; /* gps position */
double ve,vn,vd; /* gps velocity */ double ve,vn,vd; /* gps velocity */
double ITOW; double ITOW;
uint64_t err_type; /* error type */ uint64_t err_type; /* error type */
}; };
struct nav { struct nav {
@ -65,7 +65,13 @@ struct servo {
struct health { struct health {
double time; double time;
double target_roll_deg; /* AP target roll angle */
double target_heading_deg; /* AP target heading angle */
double target_pitch_deg; /* AP target pitch angle */
double target_climb_fps; /* AP target climb rate */
double target_altitude_ft; /* AP target altitude */
uint64_t command_sequence; /* highest received command sequence num */ uint64_t command_sequence; /* highest received command sequence num */
uint64_t target_waypoint; /* index of current waypoint target */
uint64_t loadavg; /* system "1 minute" load average */ uint64_t loadavg; /* system "1 minute" load average */
uint64_t ahrs_hz; /* actual ahrs loop hz */ uint64_t ahrs_hz; /* actual ahrs loop hz */
uint64_t nav_hz; /* actual nav loop hz */ uint64_t nav_hz; /* actual nav loop hz */

View file

@ -473,16 +473,18 @@ static void ugear2opengc( gps *gpspacket, imu *imupacket, nav *navpacket,
ogc->right_aileron = ((double)servopacket->chn[0] / 32768.0) - 1.0; ogc->right_aileron = ((double)servopacket->chn[0] / 32768.0) - 1.0;
ogc->rudder = 1.0 - ((double)servopacket->chn[3] / 32768.0); ogc->rudder = 1.0 - ((double)servopacket->chn[3] / 32768.0);
} }
ogc->elevator *= 4.0;
ogc->left_aileron *= 4.0;
ogc->right_aileron *= 4.0;
ogc->rudder *= 4.0;
// additional "abused" data fields // additional "abused" data fields
double fd_bank = 0.0; ogc->egt[0] = ogc->bank - healthpacket->target_roll_deg; // flight director target roll
double fd_pitch = 0.0; ogc->egt[1] = -ogc->pitch + healthpacket->target_pitch_deg; // flight director target pitch
ogc->egt[0] = ogc->bank + fd_bank; // flight director target roll ogc->egt[2] = healthpacket->target_heading_deg; // target heading bug
ogc->egt[1] = -ogc->pitch + fd_pitch; // flight director target pitch ogc->egt[3] = healthpacket->target_climb_fps; // target VVI bug
ogc->egt[2] = ogc->heading + 15; // target heading bug ogc->epr[0] = healthpacket->target_altitude_ft; // target altitude bug
ogc->egt[3] = -ogc->vvi; // target VVI bug ogc->epr[1] = 30.0; // target speed bug
ogc->epr[0] = 1400 /*ogc->elevation - 50*/ ; // target altitude bug
ogc->epr[1] = ogc->v_kcas + 5; // target speed bug
ogc->epr[2] = gps_status; // gps status box ogc->epr[2] = gps_status; // gps status box
} }
@ -1025,9 +1027,10 @@ int main( int argc, char **argv ) {
UGCommand command; UGCommand command;
// add some test commands // add some test commands
command.add("apalt,1000"); //command.add("ap,alt,1000");
command.add("home,158.0,32.5"); //command.add("home,158.0,32.5");
command.add("gohome"); //command.add("go,home");
//command.add("go,route");
while ( uavcom.is_enabled() ) { while ( uavcom.is_enabled() ) {
// cout << "looking for next message ..." << endl; // cout << "looking for next message ..." << endl;
@ -1084,9 +1087,9 @@ int main( int argc, char **argv ) {
fabs(gpspacket.alt) < 0.0001) ) fabs(gpspacket.alt) < 0.0001) )
{ {
printf("WARNING: LOST GPS!!!\n"); printf("WARNING: LOST GPS!!!\n");
gps_status = 1.0;
} else {
gps_status = -1.0; gps_status = -1.0;
} else {
gps_status = 1.0;
} }
// Generate a ground station heart beat every 5 seconds // Generate a ground station heart beat every 5 seconds