58#define ARDRONE_GPIO_PORT 0x32524
60#define ARDRONE_GPIO_PIN_MOTOR1 171
61#define ARDRONE_GPIO_PIN_MOTOR2 172
62#define ARDRONE_GPIO_PIN_MOTOR3 173
63#define ARDRONE_GPIO_PIN_MOTOR4 174
65#define ARDRONE_GPIO_PIN_IRQ_FLIPFLOP 175
66#define ARDRONE_GPIO_PIN_IRQ_INPUT 176
89 perror(
"open_port: Unable to open /dev/ttyO0 - ");
128 for (
int m = 0; m < 4; m++) {
131 if (reply[0] != 0xe0 || reply[1] != 0x00) {
132 printf(
"motor%d cmd=0x%02x reply=0x%02x\n", m + 1, (
int)reply[0], (
int)reply[1]);
162 perror(
"actuators_ardrone_cmd: write failed");
208#define BIT_NUMBER(VAL,BIT) (((VAL)>>BIT)&0x03)
235 cmd[0] = 0x20 | ((
pwm0 & 0x1ff) >> 4);
236 cmd[1] = ((
pwm0 & 0x1ff) << 4) | ((
pwm1 & 0x1ff) >> 5);
237 cmd[2] = ((
pwm1 & 0x1ff) << 3) | ((
pwm2 & 0x1ff) >> 6);
238 cmd[3] = ((
pwm2 & 0x1ff) << 2) | ((
pwm3 & 0x1ff) >> 7);
239 cmd[4] = ((
pwm3 & 0x1ff) << 1);
266 cmd[0] = 0x60 | ((
led0 & 1) << 4) | ((
led1 & 1) << 3) | ((
led2 & 1) << 2) | ((
led3 & 1) << 1);
267 cmd[1] = ((
led0 & 2) << 3) | ((
led1 & 2) << 2) | ((
led2 & 2) << 1) | ((
led3 & 2) << 0);
bool autopilot_set_motors_on(bool motors_on)
turn motors on/off, eventually depending of the current mode set kill_throttle accordingly FIXME is i...
bool autopilot_get_motors_on(void)
get motors status
Core autopilot interface common to all firmwares.
void actuators_ardrone_close(void)
void actuators_ardrone_set_leds(uint8_t led0, uint8_t led1, uint8_t led2, uint8_t led3)
Write LED command cmd = 011rrrr0 000gggg0 (this is ardrone1 format, we need ardrone2 format)
void actuators_ardrone_commit(void)
#define ARDRONE_GPIO_PIN_IRQ_INPUT
uint16_t actuators_pwm_values[ACTUATORS_ARDRONE_NB]
void actuators_ardrone_set_pwm(uint16_t pwm0, uint16_t pwm1, uint16_t pwm2, uint16_t pwm3)
Write motor speed command cmd = 001aaaaa aaaabbbb bbbbbccc ccccccdd ddddddd0.
int actuator_ardrone2_fd
Power consumption @ 11V all 4 motors running PWM A 0 0.2 80 1.3 100 1.5 150 2.0 190 2....
#define ARDRONE_GPIO_PIN_MOTOR1
void actuators_ardrone_init(void)
static void actuators_ardrone_reset_flipflop(void)
#define ARDRONE_GPIO_PORT
void actuators_ardrone_led_run(void)
int actuators_ardrone_cmd(uint8_t cmd, uint8_t *reply, int replylen)
#define ARDRONE_GPIO_PIN_MOTOR2
#define ARDRONE_GPIO_PIN_MOTOR4
#define ARDRONE_GPIO_PIN_IRQ_FLIPFLOP
#define ARDRONE_GPIO_PIN_MOTOR3
#define BIT_NUMBER(VAL, BIT)
void actuators_ardrone_motor_status(void)
#define ACTUATORS_ARDRONE_NB
void gpio_setup_output(ioportid_t port, uint16_t gpios)
Setup one or more pins of the given GPIO port as outputs.
void gpio_setup_input(ioportid_t port, uint16_t gpios)
Setup one or more pins of the given GPIO port as inputs.
static void gpio_set(ioportid_t port, uint16_t pin)
Set a gpio output to high level.
static void gpio_clear(ioportid_t port, uint16_t pin)
Clear a gpio output to low level.
static uint8_t gpio_get(ioportid_t port, uint16_t pin)
Get level of a gpio.
Some architecture independent helper functions for GPIOs.
Hardware independent API for actuators (servos, motor controllers).
ssize_t full_write(int fd, const uint8_t *buf, size_t count)
Write to fd even while being interrupted.
ssize_t full_read(int fd, uint8_t *buf, size_t count)
Read from fd even while being interrupted.
ardrone2 navdata aquisition driver.
Architecture independent timing functions.
volatile uint32_t nb_sec
full seconds since startup
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.