Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
navdata.c File Reference

ardrone2 navdata aquisition driver. More...

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <termios.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <errno.h>
#include <assert.h>
#include "std.h"
#include "navdata.h"
#include "subsystems/ins.h"
#include "subsystems/abi.h"
#include "mcu_periph/gpio.h"
+ Include dependency graph for navdata.c:

Go to the source code of this file.

Macros

#define NAVDATA_PACKET_SIZE   60
 
#define NAVDATA_START_BYTE   0x3a
 
#define ARDRONE_GPIO_PORT   0x32524
 
#define ARDRONE_GPIO_PIN_NAVDATA   177
 
#define SONAR_OFFSET   880
 Sonar offset. More...
 
#define SONAR_SCALE   0.00047
 Sonar scale. More...
 

Functions

static bool_t acquire_baro_calibration (void)
 
static void navdata_cropbuffer (int cropsize)
 
ssize_t full_write (int fd, const uint8_t *buf, size_t count)
 
ssize_t full_read (int fd, uint8_t *buf, size_t count)
 
static void navdata_write (const uint8_t *buf, size_t count)
 
bool_t navdata_init ()
 
void navdata_read ()
 
static void mag_freeze_check (void)
 
static void baro_update_logic (void)
 
void navdata_update ()
 

Variables

navdata_port nav_port
 
static int nav_fd = 0
 
measures_t navdata
 

Detailed Description

ardrone2 navdata aquisition driver.

The ardrone2 provides a navdata stream of packets containing info about all sensors at a rate of 200Hz.

Definition in file navdata.c.

Macro Definition Documentation

#define ARDRONE_GPIO_PIN_NAVDATA   177

Definition at line 50 of file navdata.c.

Referenced by mag_freeze_check(), and navdata_init().

#define ARDRONE_GPIO_PORT   0x32524

Definition at line 49 of file navdata.c.

Referenced by mag_freeze_check(), and navdata_init().

#define NAVDATA_PACKET_SIZE   60

Definition at line 46 of file navdata.c.

Referenced by navdata_update().

#define NAVDATA_START_BYTE   0x3a

Definition at line 47 of file navdata.c.

Referenced by navdata_update().

#define SONAR_OFFSET   880

Sonar offset.

Offset value in ADC equals to the ADC value so that height is zero

Definition at line 64 of file navdata.c.

Referenced by navdata_update().

#define SONAR_SCALE   0.00047

Sonar scale.

Sensor sensitivity in m/adc (float)

Definition at line 71 of file navdata.c.

Referenced by navdata_update().

Function Documentation

static void baro_update_logic ( void  )
static

Definition at line 330 of file navdata.c.

References FALSE, navdata_baro_available, measures_t::pressure, measures_t::temperature_pressure, and TRUE.

Referenced by navdata_update().

+ Here is the caller graph for this function:

ssize_t full_read ( int  fd,
uint8_t buf,
size_t  count 
)

Definition at line 93 of file navdata.c.

Referenced by acquire_baro_calibration(), actuators_ardrone_cmd(), and ahrs_propagate().

+ Here is the caller graph for this function:

ssize_t full_write ( int  fd,
const uint8_t buf,
size_t  count 
)

Definition at line 75 of file navdata.c.

Referenced by actuators_ardrone_cmd(), actuators_ardrone_set_leds(), actuators_ardrone_set_pwm(), and navdata_write().

+ Here is the caller graph for this function:

static void mag_freeze_check ( void  )
static

Definition at line 289 of file navdata.c.

References ARDRONE_GPIO_PIN_NAVDATA, ARDRONE_GPIO_PORT, gpio_clear(), gpio_set(), measures_t::mx, and navdata_write().

Referenced by navdata_update().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void navdata_cropbuffer ( int  cropsize)
static

Definition at line 564 of file navdata.c.

References navdata_port::buffer, navdata_port::bytesRead, and NAVDATA_BUFFER_SIZE.

Referenced by navdata_update().

+ Here is the caller graph for this function:

void navdata_read ( void  )

Definition at line 277 of file navdata.c.

References navdata_port::buffer, navdata_port::bytesRead, nav_fd, NAVDATA_BUFFER_SIZE, and navdata_port::totalBytesRead.

Referenced by navdata_update().

+ Here is the caller graph for this function:

static void navdata_write ( const uint8_t buf,
size_t  count 
)
static

Definition at line 112 of file navdata.c.

References full_write(), and nav_fd.

Referenced by acquire_baro_calibration(), mag_freeze_check(), and navdata_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

int nav_fd = 0
static

Definition at line 56 of file navdata.c.

Referenced by acquire_baro_calibration(), navdata_init(), navdata_read(), and navdata_write().

navdata_port nav_port

Definition at line 55 of file navdata.c.

measures_t navdata

Definition at line 57 of file navdata.c.

Referenced by ardrone_baro_event(), and imu_ardrone2_event().