mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-25 06:15:43 +08:00
[ardrone2] Full remove of raw naming
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<firmware name="rotorcraft">
|
||||
<define name="DEBUG_VFF_EXTENDED"/>
|
||||
<configure name="HOST" value="192.168.1.$(AC_ID)"/>
|
||||
<target name="ap" board="ardrone2_raw">
|
||||
<target name="ap" board="ardrone2">
|
||||
<define name="USE_SONAR"/>
|
||||
<define name="USE_BARO_MEDIAN_FILTER"/>
|
||||
<define name="AUTOPILOT_DISABLE_AHRS_KILL"/>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<firmware name="rotorcraft">
|
||||
<define name="DEBUG_VFF_EXTENDED"/>
|
||||
<configure name="HOST" value="192.168.1.$(AC_ID)"/>
|
||||
<target name="ap" board="ardrone2_raw">
|
||||
<target name="ap" board="ardrone2">
|
||||
<define name="USE_SONAR"/>
|
||||
<define name="USE_BARO_MEDIAN_FILTER"/>
|
||||
<define name="AUTOPILOT_DISABLE_AHRS_KILL"/>
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
<!DOCTYPE airframe SYSTEM "../../airframe.dtd">
|
||||
|
||||
<airframe name="ardrone2_raw">
|
||||
<airframe name="ardrone2">
|
||||
|
||||
<firmware name="rotorcraft">
|
||||
<!-- Main autopilot target -->
|
||||
<target name="ap" board="ardrone2_raw">
|
||||
<target name="ap" board="ardrone2">
|
||||
<define name="USE_INS_NAV_INIT"/>
|
||||
<configure name="AHRS_PROPAGATE_FREQUENCY" value="200"/>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<conf>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_181"
|
||||
name="Ardrone2_181"
|
||||
ac_id="181"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
@@ -10,9 +10,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_182"
|
||||
name="Ardrone2_182"
|
||||
ac_id="182"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
@@ -20,9 +20,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_183"
|
||||
name="Ardrone2_183"
|
||||
ac_id="183"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
@@ -30,9 +30,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_184"
|
||||
name="Ardrone2_184"
|
||||
ac_id="184"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
@@ -40,9 +40,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_185"
|
||||
name="Ardrone2_185"
|
||||
ac_id="185"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
@@ -50,9 +50,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_186"
|
||||
name="Ardrone2_186"
|
||||
ac_id="186"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
@@ -60,9 +60,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_187"
|
||||
name="Ardrone2_187"
|
||||
ac_id="187"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
@@ -70,9 +70,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_188"
|
||||
name="Ardrone2_188"
|
||||
ac_id="188"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
@@ -80,9 +80,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_189"
|
||||
name="Ardrone2_189"
|
||||
ac_id="189"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
@@ -90,9 +90,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_190"
|
||||
name="Ardrone2_190"
|
||||
ac_id="190"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
@@ -100,9 +100,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_191"
|
||||
name="Ardrone2_191"
|
||||
ac_id="191"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
@@ -110,9 +110,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_192"
|
||||
name="Ardrone2_192"
|
||||
ac_id="192"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
@@ -120,9 +120,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_193"
|
||||
name="Ardrone2_193"
|
||||
ac_id="193"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
@@ -130,9 +130,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_194"
|
||||
name="Ardrone2_194"
|
||||
ac_id="194"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
@@ -140,9 +140,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_195"
|
||||
name="Ardrone2_195"
|
||||
ac_id="195"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft_vision.xml"
|
||||
@@ -150,9 +150,9 @@
|
||||
gui_color="red"
|
||||
/>
|
||||
<aircraft
|
||||
name="Ardrone2_raw_196"
|
||||
name="Ardrone2_196"
|
||||
ac_id="196"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
|
||||
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!DOCTYPE airframe SYSTEM "airframe.dtd">
|
||||
|
||||
<airframe name="ardrone2_raw">
|
||||
<airframe name="ardrone2">
|
||||
|
||||
<firmware name="rotorcraft">
|
||||
<target name="ap" board="ardrone2_raw"/>
|
||||
<target name="ap" board="ardrone2"/>
|
||||
|
||||
<target name="nps" board="pc">
|
||||
<subsystem name="fdm" type="jsbsim"/>
|
||||
@@ -3,7 +3,7 @@
|
||||
<airframe name="ardrone2_indi">
|
||||
|
||||
<firmware name="rotorcraft">
|
||||
<target name="ap" board="ardrone2_raw">
|
||||
<target name="ap" board="ardrone2">
|
||||
<define name="AUTOPILOT_DISABLE_AHRS_KILL"/>
|
||||
<subsystem name="telemetry" type="transparent_udp"/>
|
||||
<subsystem name="radio_control" type="datalink"/>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<airframe name="ardrone2_opticflow">
|
||||
|
||||
<firmware name="rotorcraft">
|
||||
<target name="ap" board="ardrone2_raw"/>
|
||||
<target name="ap" board="ardrone2"/>
|
||||
|
||||
<!--target name="nps" board="pc">
|
||||
<subsystem name="fdm" type="jsbsim"/>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!DOCTYPE airframe SYSTEM "airframe.dtd">
|
||||
|
||||
<airframe name="ardrone2_raw">
|
||||
<airframe name="ardrone2_optitrack">
|
||||
|
||||
<firmware name="rotorcraft">
|
||||
<target name="ap" board="ardrone2_raw">
|
||||
<target name="ap" board="ardrone2">
|
||||
<define name="FAILSAFE_DESCENT_SPEED" value="0.5"/>
|
||||
<configure name="USE_MAGNETOMETER" value="0"/>
|
||||
</target>
|
||||
@@ -1,14 +1,13 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#
|
||||
# ardrone2_raw.makefile
|
||||
# ardrone2.makefile
|
||||
#
|
||||
# http://wiki.paparazziuav.org/wiki/AR.Drone_2_-_Specifications
|
||||
#
|
||||
|
||||
BOARD=ardrone
|
||||
BOARD_VERSION=2
|
||||
BOARD_TYPE=raw
|
||||
BOARD_CFG=\"boards/$(BOARD)$(BOARD_VERSION)_$(BOARD_TYPE).h\"
|
||||
BOARD_CFG=\"boards/$(BOARD)$(BOARD_VERSION).h\"
|
||||
|
||||
ARCH=linux
|
||||
$(TARGET).ARCHDIR = $(ARCH)
|
||||
@@ -18,7 +17,7 @@ ap.MAKEFILE = ardrone2
|
||||
# -----------------------------------------------------------------------
|
||||
USER=foobar
|
||||
HOST?=192.168.1.1
|
||||
SUB_DIR=raw
|
||||
SUB_DIR=paparazzi
|
||||
FTP_DIR=/data/video
|
||||
TARGET_DIR=$(FTP_DIR)/$(SUB_DIR)
|
||||
# -----------------------------------------------------------------------
|
||||
@@ -36,9 +35,6 @@ GPS_BAUD ?= B57600
|
||||
# The datalink default uses UDP
|
||||
MODEM_HOST ?= 192.168.1.255
|
||||
|
||||
# for distinction between RAW and SDK version
|
||||
$(TARGET).CFLAGS +=-DARDRONE2_RAW
|
||||
|
||||
# handle linux signals by hand
|
||||
$(TARGET).CFLAGS += -DUSE_LINUX_SIGNAL -D_GNU_SOURCE
|
||||
|
||||
@@ -198,9 +198,9 @@
|
||||
gui_color="blue"
|
||||
/>
|
||||
<aircraft
|
||||
name="ardrone2_raw"
|
||||
name="ardrone2"
|
||||
ac_id="201"
|
||||
airframe="airframes/ardrone2_raw.xml"
|
||||
airframe="airframes/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/rotorcraft_basic.xml"
|
||||
|
||||
+2
-2
@@ -330,9 +330,9 @@
|
||||
gui_color="blue"
|
||||
/>
|
||||
<aircraft
|
||||
name="ardrone2_raw"
|
||||
name="ardrone2"
|
||||
ac_id="201"
|
||||
airframe="airframes/ardrone2_raw.xml"
|
||||
airframe="airframes/ardrone2.xml"
|
||||
radio="radios/cockpitSX.xml"
|
||||
telemetry="telemetry/default_ardrone.xml"
|
||||
flight_plan="flight_plans/rotorcraft_basic.xml"
|
||||
|
||||
@@ -137,8 +137,8 @@ endif
|
||||
ifeq ($(BOARD), booz)
|
||||
ns_CFLAGS += -DUSE_DAC
|
||||
ns_srcs += $(SRC_ARCH)/mcu_periph/dac_arch.c
|
||||
else ifeq ($(BOARD)$(BOARD_TYPE), ardroneraw)
|
||||
ns_srcs += $(SRC_BOARD)/electrical_raw.c
|
||||
else ifeq ($(BOARD), ardrone)
|
||||
ns_srcs += $(SRC_BOARD)/electrical.c
|
||||
else ifeq ($(BOARD), bebop)
|
||||
ns_srcs += $(SRC_BOARD)/electrical.c
|
||||
endif
|
||||
@@ -167,7 +167,7 @@ ifeq ($(ARCH), stm32)
|
||||
ns_srcs += $(SRC_ARCH)/led_hw.c
|
||||
endif
|
||||
|
||||
ifeq ($(BOARD)$(BOARD_TYPE), ardroneraw)
|
||||
ifeq ($(BOARD), ardrone)
|
||||
ns_srcs += $(SRC_BOARD)/gpio_ardrone.c
|
||||
endif
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
# Actuator drivers for the raw ardrone version are included here
|
||||
|
||||
ap.CFLAGS += -DACTUATORS
|
||||
ap.srcs += $(SRC_BOARD)/actuators_ardrone2_raw.c
|
||||
ap.srcs += $(SRC_BOARD)/actuators.c
|
||||
|
||||
@@ -26,7 +26,7 @@ else ifeq ($(BOARD), navstik)
|
||||
BARO_BOARD_SRCS += $(SRC_BOARD)/baro_board.c
|
||||
|
||||
# Ardrone baro
|
||||
else ifeq ($(BOARD)$(BOARD_TYPE), ardroneraw)
|
||||
else ifeq ($(BOARD), ardrone)
|
||||
BARO_BOARD_SRCS += $(SRC_BOARD)/baro_board.c
|
||||
|
||||
# Bebop baro
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# imu AR.Drone2
|
||||
|
||||
imu_CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_ardrone2_raw.h\" -DUSE_IMU
|
||||
imu_CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_ardrone2.h\" -DUSE_IMU
|
||||
imu_srcs += $(SRC_SUBSYSTEMS)/imu.c
|
||||
imu_srcs += $(SRC_SUBSYSTEMS)/imu/imu_ardrone2_raw.c
|
||||
imu_srcs += $(SRC_SUBSYSTEMS)/imu/imu_ardrone2.c
|
||||
imu_srcs += $(SRC_BOARD)/navdata.c
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <stdint.h>
|
||||
#include BOARD_CONFIG
|
||||
|
||||
#if defined BOARD_ARDRONE2_RAW
|
||||
#if defined BOARD_ARDRONE2
|
||||
extern uint32_t led_hw_values;
|
||||
#define LED_INIT(i) { led_hw_values &= ~(1<<i); }
|
||||
#define LED_ON(i) { led_hw_values |= (1<<i); }
|
||||
|
||||
+15
-15
@@ -24,12 +24,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file boards/ardrone/actuators_ardrone2_raw.c
|
||||
* Actuator driver for ardrone2-raw version
|
||||
* @file boards/ardrone/actuators.c
|
||||
* Actuator driver for ardrone2 version
|
||||
*/
|
||||
|
||||
#include "subsystems/actuators.h"
|
||||
#include "actuators_ardrone2_raw.h"
|
||||
#include "actuators.h"
|
||||
#include "mcu_periph/gpio.h"
|
||||
#include "led_hw.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
@@ -53,7 +53,7 @@
|
||||
* 190 2.5
|
||||
* 130 3.0
|
||||
*/
|
||||
int actuator_ardrone2_raw_fd; /**< File descriptor for the port */
|
||||
int actuator_ardrone2_fd; /**< File descriptor for the port */
|
||||
|
||||
#define ARDRONE_GPIO_PORT 0x32524
|
||||
|
||||
@@ -83,18 +83,18 @@ void actuators_ardrone_init(void)
|
||||
led_hw_values = 0;
|
||||
|
||||
//open mot port
|
||||
actuator_ardrone2_raw_fd = open("/dev/ttyO0", O_RDWR | O_NOCTTY | O_NDELAY);
|
||||
if (actuator_ardrone2_raw_fd == -1) {
|
||||
actuator_ardrone2_fd = open("/dev/ttyO0", O_RDWR | O_NOCTTY | O_NDELAY);
|
||||
if (actuator_ardrone2_fd == -1) {
|
||||
perror("open_port: Unable to open /dev/ttyO0 - ");
|
||||
return;
|
||||
}
|
||||
fcntl(actuator_ardrone2_raw_fd, F_SETFL, 0); //read calls are non blocking
|
||||
fcntl(actuator_ardrone2_raw_fd, F_GETFL, 0);
|
||||
fcntl(actuator_ardrone2_fd, F_SETFL, 0); //read calls are non blocking
|
||||
fcntl(actuator_ardrone2_fd, F_GETFL, 0);
|
||||
|
||||
//set port options
|
||||
struct termios options;
|
||||
//Get the current options for the port
|
||||
tcgetattr(actuator_ardrone2_raw_fd, &options);
|
||||
tcgetattr(actuator_ardrone2_fd, &options);
|
||||
//Set the baud rates to 115200
|
||||
cfsetispeed(&options, B115200);
|
||||
cfsetospeed(&options, B115200);
|
||||
@@ -105,7 +105,7 @@ void actuators_ardrone_init(void)
|
||||
options.c_oflag &= ~OPOST; //clear output options (raw output)
|
||||
|
||||
//Set the new options for the port
|
||||
tcsetattr(actuator_ardrone2_raw_fd, TCSANOW, &options);
|
||||
tcsetattr(actuator_ardrone2_fd, TCSANOW, &options);
|
||||
|
||||
//reset IRQ flipflop - on error 106 read 1, this code resets 106 to 0
|
||||
gpio_setup_input(ARDRONE_GPIO_PORT, ARDRONE_GPIO_PIN_IRQ_INPUT);
|
||||
@@ -157,11 +157,11 @@ void actuators_ardrone_init(void)
|
||||
|
||||
int actuators_ardrone_cmd(uint8_t cmd, uint8_t *reply, int replylen)
|
||||
{
|
||||
if (full_write(actuator_ardrone2_raw_fd, &cmd, 1) < 0) {
|
||||
if (full_write(actuator_ardrone2_fd, &cmd, 1) < 0) {
|
||||
perror("actuators_ardrone_cmd: write failed");
|
||||
return -1;
|
||||
}
|
||||
return full_read(actuator_ardrone2_raw_fd, reply, replylen);
|
||||
return full_read(actuator_ardrone2_fd, reply, replylen);
|
||||
}
|
||||
|
||||
#include "autopilot.h"
|
||||
@@ -236,7 +236,7 @@ void actuators_ardrone_set_pwm(uint16_t pwm0, uint16_t pwm1, uint16_t pwm2, uint
|
||||
cmd[2] = ((pwm1 & 0x1ff) << 3) | ((pwm2 & 0x1ff) >> 6);
|
||||
cmd[3] = ((pwm2 & 0x1ff) << 2) | ((pwm3 & 0x1ff) >> 7);
|
||||
cmd[4] = ((pwm3 & 0x1ff) << 1);
|
||||
full_write(actuator_ardrone2_raw_fd, cmd, 5);
|
||||
full_write(actuator_ardrone2_fd, cmd, 5);
|
||||
RunOnceEvery(20, actuators_ardrone_led_run());
|
||||
}
|
||||
|
||||
@@ -265,10 +265,10 @@ void actuators_ardrone_set_leds(uint8_t led0, uint8_t led1, uint8_t led2, uint8_
|
||||
cmd[0] = 0x60 | ((led0 & 1) << 4) | ((led1 & 1) << 3) | ((led2 & 1) << 2) | ((led3 & 1) << 1);
|
||||
cmd[1] = ((led0 & 2) << 3) | ((led1 & 2) << 2) | ((led2 & 2) << 1) | ((led3 & 2) << 0);
|
||||
|
||||
full_write(actuator_ardrone2_raw_fd, cmd, 2);
|
||||
full_write(actuator_ardrone2_fd, cmd, 2);
|
||||
}
|
||||
|
||||
void actuators_ardrone_close(void)
|
||||
{
|
||||
close(actuator_ardrone2_raw_fd);
|
||||
close(actuator_ardrone2_fd);
|
||||
}
|
||||
+4
-4
@@ -24,12 +24,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file boards/ardrone/actuators_ardrone2_raw.h
|
||||
* @file boards/ardrone/actuators.h
|
||||
* Actuator driver for ardrone2-raw version
|
||||
*/
|
||||
|
||||
#ifndef ACTUATORS_ARDRONE2_RAW_H_
|
||||
#define ACTUATORS_ARDRONE2_RAW_H_
|
||||
#ifndef ACTUATORS_ARDRONE2_H_
|
||||
#define ACTUATORS_ARDRONE2_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -59,4 +59,4 @@ void actuators_ardrone_set_pwm(uint16_t pwm0, uint16_t pwm1, uint16_t pwm2, uint
|
||||
void actuators_ardrone_set_leds(uint8_t led0, uint8_t led1, uint8_t led2, uint8_t led3);
|
||||
void actuators_ardrone_close(void);
|
||||
|
||||
#endif /* ACTUATORS_ARDRONE2_RAW_H_ */
|
||||
#endif /* ACTUATORS_ARDRONE2_H_ */
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
* arch specific electrical status readings
|
||||
*/
|
||||
|
||||
#include "electrical_raw.h"
|
||||
#include "electrical.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -22,8 +22,6 @@
|
||||
* ardrone GPIO driver
|
||||
*/
|
||||
|
||||
#ifdef ARDRONE2_RAW
|
||||
|
||||
#include <fcntl.h> /* File control definitions */
|
||||
#include <errno.h> /* Error number definitions */
|
||||
#include <sys/ioctl.h>
|
||||
@@ -133,5 +131,3 @@ uint16_t gpio_get(uint32_t port, uint16_t pin)
|
||||
ioctl(gpiofp, GPIO_READ, &data);
|
||||
return data.value;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef CONFIG_ARDRONE2_RAW
|
||||
#define CONFIG_ARDRONE2_RAW
|
||||
#ifndef CONFIG_ARDRONE2
|
||||
#define CONFIG_ARDRONE2
|
||||
|
||||
#define BOARD_ARDRONE2_RAW
|
||||
#define BOARD_ARDRONE2
|
||||
|
||||
#define UART1_DEV "/dev/ttyUSB0"
|
||||
|
||||
/* Default actuators driver */
|
||||
#define DEFAULT_ACTUATORS "boards/ardrone/actuators_ardrone2_raw.h"
|
||||
#define DEFAULT_ACTUATORS "boards/ardrone/actuators.h"
|
||||
#define ActuatorDefaultSet(_x,_y) ActuatorArdroneSet(_x,_y)
|
||||
#define ActuatorsDefaultInit() ActuatorsArdroneInit()
|
||||
#define ActuatorsDefaultCommit() ActuatorsArdroneCommit()
|
||||
@@ -17,4 +17,4 @@
|
||||
#define USE_BARO_BOARD 1
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_ARDRONE2_RAW */
|
||||
#endif /* CONFIG_ARDRONE2 */
|
||||
+3
-3
@@ -20,13 +20,13 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file subsystems/imu/imu_ardrone2_raw.c
|
||||
* IMU implementation for ardrone2-raw.
|
||||
* @file subsystems/imu/imu_ardrone2.c
|
||||
* IMU implementation for ardrone2.
|
||||
*/
|
||||
|
||||
#include "subsystems/imu.h"
|
||||
#include "navdata.h"
|
||||
#include "imu_ardrone2_raw.h"
|
||||
#include "imu_ardrone2.h"
|
||||
#include "mcu_periph/uart.h"
|
||||
|
||||
void imu_impl_init(void)
|
||||
+5
-5
@@ -20,12 +20,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file subsystems/imu/imu_ardrone2_raw.h
|
||||
* IMU implementation for ardrone2-raw.
|
||||
* @file subsystems/imu/imu_ardrone2.h
|
||||
* IMU implementation for ardrone2.
|
||||
*/
|
||||
|
||||
#ifndef IMU_ARDRONE2_RAW_H_
|
||||
#define IMU_ARDRONE2_RAW_H_
|
||||
#ifndef IMU_ARDRONE2_H_
|
||||
#define IMU_ARDRONE2_H_
|
||||
|
||||
#include "generated/airframe.h"
|
||||
#include "navdata.h"
|
||||
@@ -87,4 +87,4 @@
|
||||
|
||||
#define ImuEvent navdata_update
|
||||
|
||||
#endif /* IMU_ARDRONE2_RAW_H_ */
|
||||
#endif /* IMU_ARDRONE2_H_ */
|
||||
-488
@@ -1,488 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
import re
|
||||
import argparse
|
||||
import socket
|
||||
import telnetlib
|
||||
import os
|
||||
from time import sleep
|
||||
from ftplib import FTP
|
||||
|
||||
|
||||
# Check if IP is valid
|
||||
def is_ip(address):
|
||||
try:
|
||||
socket.inet_aton(address)
|
||||
ip = True
|
||||
except socket.error:
|
||||
ip = False
|
||||
return ip
|
||||
|
||||
# Execute a command
|
||||
def execute_command(command):
|
||||
tn.write(command + '\n')
|
||||
return tn.read_until('# ')[len(command) + 2:-4]
|
||||
|
||||
# Helper function
|
||||
def split_into_path_and_file(name):
|
||||
if name.count('/') <= 0:
|
||||
return ["./", name]
|
||||
return name.rsplit('/', 1)
|
||||
|
||||
# Read from config.ini
|
||||
def read_from_config(name, config=''):
|
||||
if config == '':
|
||||
config = execute_command('cat /data/config.ini')
|
||||
search = re.search(name + '[^=]+=[\r\n\t ]([^\r\n\t ]+)', config)
|
||||
if search is None:
|
||||
return ''
|
||||
else:
|
||||
return search.group(1)
|
||||
|
||||
# Write to config
|
||||
def write_to_config(name, value):
|
||||
if read_from_config(name) == '':
|
||||
execute_command('echo "' + name + ' = ' + value + '\" >> /data/config.ini')
|
||||
else:
|
||||
execute_command('sed -i "s/\(' + name + ' *= *\).*/\\1' + value + '/g" /data/config.ini')
|
||||
|
||||
# Check the version
|
||||
def check_version():
|
||||
return execute_command('cat /firmware/version.txt')
|
||||
|
||||
# Check what currently is running on the drone
|
||||
def check_running():
|
||||
ps_aux = execute_command('ps')
|
||||
running = ""
|
||||
|
||||
if 'program.elf' in ps_aux:
|
||||
running += ' Native (program.elf),'
|
||||
if 'ap.elf' in ps_aux:
|
||||
running += ' Paparazzi (ap.elf),'
|
||||
if 'gst-launch' in ps_aux:
|
||||
running += ' GStreamer (gst-launch)'
|
||||
return running[1:]
|
||||
|
||||
# Check if vision framework is installed
|
||||
def check_vision_installed():
|
||||
du_opt = execute_command('du -d 2 /data/video/opt')
|
||||
return '/data/video/opt/arm/gst' in du_opt or '/data/video/opt/arm/lib' in du_opt or '/data/video/opt/arm/tidsp-binaries-23.i3.8' in du_opt
|
||||
|
||||
# Check if the vision framework is running
|
||||
def check_vision_running():
|
||||
du_opt = execute_command('du -d 2 /opt')
|
||||
return '/opt/arm/gst' in du_opt and '/opt/arm/lib' in du_opt and '/opt/arm/tidsp-binaries-23.i3.8' in du_opt
|
||||
|
||||
# Check if autoboot is installed
|
||||
def check_autoboot():
|
||||
check_update = execute_command('grep "START_PAPARAZZI" /bin/check_update.sh')
|
||||
wifi_setup = execute_command('grep "BASE_ADRESS" /bin/wifi_setup.sh')
|
||||
if "START_PAPARAZZI" in check_update and "BASE_ADRESS" in wifi_setup:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
# Check if custom wifi_setup script is installed
|
||||
def check_wifi_setup():
|
||||
check_wifi = execute_command('grep "static_ip_address_base" /bin/wifi_setup.sh')
|
||||
if "static_ip_address_base" in check_wifi:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
# Check the filesystem
|
||||
def check_filesystem():
|
||||
return execute_command('df -h')
|
||||
|
||||
# Reboot the drone
|
||||
def bebop_reboot():
|
||||
execute_command('reboot')
|
||||
|
||||
# Install the vision framework
|
||||
def bebop_install_vision():
|
||||
print('Uploading GST')
|
||||
ftp.storbinary("STOR arm_light.tgz", file("bin/arm_light.tgz", "rb"))
|
||||
print(execute_command("cd /data/video && tar -xzf arm_light.tgz"))
|
||||
print(execute_command("rm -rf /data/video/arm_light.tgz"))
|
||||
print('Now Starting Vision')
|
||||
bebop_start_vision()
|
||||
|
||||
# Remove the vision framework
|
||||
def bebop_remove_vision():
|
||||
execute_command("rm -rf /opt/arm")
|
||||
execute_command("rm -rf /lib/dsp")
|
||||
execute_command("rm -rf /data/video/opt")
|
||||
|
||||
# Start the vision framework
|
||||
def bebop_start_vision():
|
||||
# Mount the directories
|
||||
execute_command("mkdir -p /opt/arm")
|
||||
execute_command("mkdir -p /lib/dsp")
|
||||
execute_command("mount --bind /data/video/opt/arm /opt/arm")
|
||||
execute_command("mount --bind /data/video/opt/arm/lib/dsp /lib/dsp")
|
||||
# Start The DSP programs
|
||||
execute_command("kill -9 `pidof program.elf`")
|
||||
execute_command("kill -9 `pidof gst-launch-0.10`")
|
||||
execute_command("export PATH=/opt/arm/gst/bin:$PATH")
|
||||
execute_command("export DSP_PATH=/opt/arm/tidsp-binaries-23.i3.8/")
|
||||
execute_command("/bin/dspbridge/cexec.out -T /opt/arm/tidsp-binaries-23.i3.8/baseimage.dof -v")
|
||||
execute_command("/bin/dspbridge/dynreg.out -r /opt/arm/tidsp-binaries-23.i3.8/m4venc_sn.dll64P -v")
|
||||
# Show result
|
||||
execute_command("ls -altr /opt/arm/gst/bin")
|
||||
|
||||
# Install autoboot script
|
||||
def bebop_install_autoboot():
|
||||
print('Uploading autoboot script')
|
||||
ftp.storbinary("STOR check_update.sh", file("check_update.sh", "rb"))
|
||||
print(execute_command("mv /data/video/check_update.sh /bin/check_update.sh"))
|
||||
print(execute_command("chmod 777 /bin/check_update.sh"))
|
||||
|
||||
# Install network script
|
||||
def bebop_install_network_script():
|
||||
print('Uploading Wifi script')
|
||||
ftp.storbinary("STOR wifi_setup.sh", file("wifi_setup.sh", "rb"))
|
||||
print(execute_command("mv /data/video/wifi_setup.sh /bin/wifi_setup.sh"))
|
||||
print(execute_command("chmod 777 /bin/wifi_setup.sh"))
|
||||
|
||||
# Set network SSID
|
||||
def bebop_set_ssid(name):
|
||||
write_to_config('ssid_single_player', name)
|
||||
print('The network ID (SSID) of the Bebop is changed to ' + name)
|
||||
|
||||
# Set IP address
|
||||
def bebop_set_ip_address(address):
|
||||
splitted_ip = address.split(".")
|
||||
write_to_config('static_ip_address_base', splitted_ip[0] + '.' + splitted_ip[1] + '.' + splitted_ip[2] + '.')
|
||||
write_to_config('static_ip_address_probe', splitted_ip[3])
|
||||
print('The IP Address of the Bebop is changed to ' + address)
|
||||
|
||||
# Set wifi mode (0: master, 1: ad-hoc, 2: managed, *: master)
|
||||
def bebop_set_wifi_mode(mode):
|
||||
modes = { 'master' : '0', 'ad-hoc' : '1', 'managed' : '2' }
|
||||
try:
|
||||
val = modes[mode]
|
||||
except:
|
||||
print('Unexpected wifi mode, setting to master (default)')
|
||||
val = modes['master']
|
||||
write_to_config('wifi_mode', val)
|
||||
print('The Wifi mode of the Bebop is changed to ' + mode + ' (' + val + ')')
|
||||
|
||||
def bebop_status():
|
||||
config_ini = execute_command('cat /data/config.ini')
|
||||
|
||||
print('======================== Bebop Status ========================')
|
||||
print('Version:\t\t' + check_version())
|
||||
print('Host:\t\t\t' + args.host + ' (' + read_from_config('static_ip_address_base', config_ini) +
|
||||
read_from_config('static_ip_address_probe', config_ini) + ' after boot)')
|
||||
print('Currently running:\t' + check_running())
|
||||
print('Serial number:\t\t' + read_from_config('drone_serial', config_ini))
|
||||
print('Network id:\t\t' + read_from_config('ssid_single_player', config_ini))
|
||||
print('Motor software:\t\t' +
|
||||
read_from_config('motor1_soft', config_ini) + '\t' + read_from_config('motor2_soft', config_ini) + '\t' +
|
||||
read_from_config('motor3_soft', config_ini) + '\t' + read_from_config('motor4_soft', config_ini))
|
||||
print('Motor hardware:\t\t' +
|
||||
read_from_config('motor1_hard', config_ini) + '\t' + read_from_config('motor2_hard', config_ini) + '\t' +
|
||||
read_from_config('motor3_hard', config_ini) + '\t' + read_from_config('motor4_hard', config_ini))
|
||||
|
||||
autorun = {'': 'Native', '0': 'Native', '1': 'Paparazzi'}
|
||||
if check_autoboot():
|
||||
print('Autorun at start:\tInstalled booting ' + autorun[read_from_config('start_paparazzi', config_ini)])
|
||||
else:
|
||||
print('Autorun at start:\tNot installed')
|
||||
|
||||
# Check if the vision framework is installed and running
|
||||
vision_framework = ""
|
||||
if check_vision_installed():
|
||||
vision_framework += "Installed"
|
||||
if check_vision_running():
|
||||
vision_framework += " and running"
|
||||
print('Vision framework:\t' + vision_framework)
|
||||
|
||||
# Request the filesystem status
|
||||
print('\n======================== Filesystem Status ========================')
|
||||
print(check_filesystem())
|
||||
|
||||
|
||||
# Parse the arguments
|
||||
parser = argparse.ArgumentParser(description='Bebop python helper. Use bebop.py -h for help')
|
||||
parser.add_argument('--host', metavar='HOST', default='192.168.42.1',
|
||||
help='the ip address of bebop')
|
||||
subparsers = parser.add_subparsers(title='Command to execute', metavar='command', dest='command')
|
||||
|
||||
# All the subcommands and arguments
|
||||
subparsers.add_parser('status', help='Request the status of the Bebop')
|
||||
subparsers.add_parser('reboot', help='Reboot the Bebop')
|
||||
subparsers.add_parser('installvision', help='Install the vision framework')
|
||||
subparser_upload_gst = subparsers.add_parser('upload_gst_module',
|
||||
help='Upload, configure and move a gstreamer0.10 module libXXX.so')
|
||||
subparser_upload_gst.add_argument('file', help='Filename of *.so module')
|
||||
subparser_upload_and_run = subparsers.add_parser('upload_file_and_run', help='Upload and run software (for instance the Paparazzi autopilot)')
|
||||
subparser_upload_and_run.add_argument('file', help='Filename of an executable')
|
||||
subparser_upload_and_run.add_argument('folder', help='Destination subfolder (raw for Paparazzi autopilot)')
|
||||
subparser_upload = subparsers.add_parser('upload_file', help='Upload a file to the Bebop')
|
||||
subparser_upload.add_argument('file', help='Filename')
|
||||
subparser_upload.add_argument('folder', help='Destination subfolder (base destination folder is /data/video)')
|
||||
subparser_download = subparsers.add_parser('download_file', help='Download a file from the Bebop')
|
||||
subparser_download.add_argument('file', help='Filename (with the path on the local machine)')
|
||||
subparser_download.add_argument('folder', help='Remote subfolder (base folder is /data/video)')
|
||||
subparser_download_dir = subparsers.add_parser('download_dir', help='Download all files from a folder from the Bebop')
|
||||
subparser_download_dir.add_argument('dest', help='destination folder (on the local machine)')
|
||||
subparser_download_dir.add_argument('folder', help='Remote subfolder (base folder is /data/video)')
|
||||
subparser_rm_dir = subparsers.add_parser('rm_dir', help='Remove a directory and all its files from the Bebop')
|
||||
subparser_rm_dir.add_argument('folder', help='Remote subfolder (base folder is /data/video)')
|
||||
subparser_insmod = subparsers.add_parser('insmod', help='Upload and insert kernel module')
|
||||
subparser_insmod.add_argument('file', help='Filename of *.ko kernel module')
|
||||
subparsers.add_parser('startvision', help='Start the vision framework')
|
||||
subparser_start = subparsers.add_parser('start', help='Start a program on the Bebop')
|
||||
subparser_start.add_argument('program', help='the program to start')
|
||||
subparser_kill = subparsers.add_parser('kill', help='Kill a program on the Bebop')
|
||||
subparser_kill.add_argument('program', help='the program to kill')
|
||||
subparser_networkid = subparsers.add_parser('networkid', help='Set the network ID(SSID) of the Bebop')
|
||||
subparser_networkid.add_argument('name', help='the new network ID(SSID)')
|
||||
subparser_ipaddress = subparsers.add_parser('ipaddress', help='Set the IP address of the Bebop')
|
||||
subparser_ipaddress.add_argument('address', help='the new IP address')
|
||||
subparser_wifimode = subparsers.add_parser('wifimode', help='Set the Wifi mode the Bebop')
|
||||
subparser_wifimode.add_argument('mode', help='the new Wifi mode', choices=['master', 'ad-hoc', 'managed'])
|
||||
subparser_configure_network = subparsers.add_parser('configure_network', help='Configure the network on the Bebop')
|
||||
subparser_configure_network.add_argument('name', help='the new network ID(SSID)')
|
||||
subparser_configure_network.add_argument('address', help='the new IP address')
|
||||
subparser_configure_network.add_argument('mode', help='the new Wifi mode', choices=['master', 'ad-hoc', 'managed'])
|
||||
subparser_install_autostart = subparsers.add_parser('install_autostart', help='Install custom autostart script and set what to start on boot for the Bebop')
|
||||
subparser_install_autostart.add_argument('type', choices=['native', 'paparazzi'],
|
||||
help='what to start on boot')
|
||||
subparser_autostart = subparsers.add_parser('autostart', help='Set what to start on boot for the Bebop')
|
||||
subparser_autostart.add_argument('type', choices=['native', 'paparazzi'],
|
||||
help='what to start on boot')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Connect with telnet and ftp
|
||||
try:
|
||||
tn = telnetlib.Telnet(args.host)
|
||||
ftp = FTP(args.host)
|
||||
ftp.login()
|
||||
except:
|
||||
print('Could not connect to Bebop (host: ' + args.host + ')')
|
||||
exit(2)
|
||||
|
||||
# Read until after login
|
||||
tn.read_until('# ')
|
||||
|
||||
# Check the Bebop status
|
||||
if args.command == 'status':
|
||||
bebop_status()
|
||||
|
||||
# Reboot the drone
|
||||
elif args.command == 'reboot':
|
||||
bebop_reboot()
|
||||
print('The Bebop is rebooting...')
|
||||
|
||||
# Kill a program
|
||||
elif args.command == 'kill':
|
||||
execute_command('killall -9 ' + args.program)
|
||||
print('Program "' + args.program + '" is now killed')
|
||||
|
||||
# Start a program
|
||||
elif args.command == 'start':
|
||||
execute_command(args.start + ' &')
|
||||
print('Program "' + args.start + '" is now started')
|
||||
|
||||
# Change the network ID
|
||||
elif args.command == 'networkid':
|
||||
bebop_set_ssid(args.name)
|
||||
|
||||
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
|
||||
bebop_reboot()
|
||||
|
||||
# Change the IP address
|
||||
elif args.command == 'ipaddress':
|
||||
bebop_set_ip_address(args.address)
|
||||
|
||||
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
|
||||
bebop_reboot()
|
||||
|
||||
# Change the wifi mode
|
||||
elif args.command == 'wifimode':
|
||||
bebop_set_wifi_mode(args.mode)
|
||||
|
||||
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
|
||||
bebop_reboot()
|
||||
|
||||
# Install and configure network
|
||||
elif args.command == 'configure_network':
|
||||
config_ini = execute_command('cat /data/config.ini')
|
||||
print('=== Current network setup ===')
|
||||
print('Network id:\t' + read_from_config('ssid_single_player', config_ini))
|
||||
print('Host:\t\t' + args.host + ' (' + read_from_config('static_ip_address_base', config_ini) +
|
||||
read_from_config('static_ip_address_probe', config_ini) + ' after boot)')
|
||||
print('Mode:\t\t' + read_from_config('wifi_mode', config_ini))
|
||||
print('=============================')
|
||||
if check_wifi_setup():
|
||||
print('Custom Wifi script already installed')
|
||||
if raw_input("Shall I reinstall the Wifi script (y/N) ").lower() == 'y':
|
||||
bebop_install_network_script()
|
||||
else:
|
||||
if raw_input("Shall I install custom Wifi script (recommanded) (y/N) ").lower() == 'y':
|
||||
bebop_install_network_script()
|
||||
bebop_set_ssid(args.name)
|
||||
bebop_set_ip_address(args.address)
|
||||
bebop_set_wifi_mode(args.mode)
|
||||
config_ini = execute_command('cat /data/config.ini')
|
||||
print('== New network setup after boot ==')
|
||||
print('Network id:\t' + read_from_config('ssid_single_player', config_ini))
|
||||
print('Host:\t\t' + read_from_config('static_ip_address_base', config_ini) +
|
||||
read_from_config('static_ip_address_probe', config_ini))
|
||||
print('Mode:\t\t' + read_from_config('wifi_mode', config_ini))
|
||||
print('==================================')
|
||||
|
||||
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
|
||||
bebop_reboot()
|
||||
|
||||
# Install and configure autostart
|
||||
elif args.command == 'install_autostart':
|
||||
if check_autoboot():
|
||||
print('Custom autostart script already installed')
|
||||
if raw_input("Shall I reinstall the autostart script (y/N) ").lower() == 'y':
|
||||
bebop_install_autoboot()
|
||||
else:
|
||||
bebop_install_autoboot()
|
||||
autorun = {'native': '0', 'paparazzi': '1'}
|
||||
write_to_config('start_paparazzi', autorun[args.type])
|
||||
print('The autostart on boot is changed to ' + args.type)
|
||||
|
||||
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
|
||||
bebop_reboot()
|
||||
|
||||
# Change the autostart
|
||||
elif args.command == 'autostart':
|
||||
autorun = {'native': '0', 'paparazzi': '1'}
|
||||
write_to_config('start_paparazzi', autorun[args.type])
|
||||
print('The autostart on boot is changed to ' + args.type)
|
||||
|
||||
# Install Vision framework
|
||||
elif args.command == 'installvision':
|
||||
if check_vision_installed():
|
||||
print('Vision framework already installed')
|
||||
if raw_input("Shall I reinstall the vision framework? (y/N) ").lower() == 'y':
|
||||
bebop_remove_vision()
|
||||
bebop_install_vision()
|
||||
|
||||
bebop_install_vision()
|
||||
print('Vision framework installed')
|
||||
|
||||
# Start Vision framework
|
||||
elif args.command == 'startvision':
|
||||
if check_vision_running():
|
||||
print('Vision framework already started')
|
||||
else:
|
||||
if not check_vision_installed():
|
||||
print('No vision framework installed')
|
||||
if raw_input("Shall I install the vision framework? (y/N) ").lower() == 'y':
|
||||
bebop_install_vision()
|
||||
|
||||
if check_vision_installed():
|
||||
bebop_start_vision()
|
||||
print('Vision framework started')
|
||||
|
||||
elif args.command == 'upload_gst_module':
|
||||
print('Uploading ...' + args.file)
|
||||
ftp.storbinary("STOR " + args.file, file(args.file, "rb"))
|
||||
execute_command("chmod 777 /data/video/" + args.file)
|
||||
execute_command("mv /data/video/" + args.file + " /data/video/opt/arm/gst/lib/gstreamer-0.10")
|
||||
if check_vision_running():
|
||||
print('Info: Vision framework already started')
|
||||
else:
|
||||
if not check_vision_installed():
|
||||
print('Warning: No vision framework installed')
|
||||
if raw_input("Warning: Shall I install the vision framework? (y/N) ").lower() == 'y':
|
||||
bebop_install_vision()
|
||||
|
||||
if check_vision_installed():
|
||||
bebop_start_vision()
|
||||
print('#pragma message: Vision framework started')
|
||||
print('#pragma message: Vision Plugin Uploaded and DSP Started.')
|
||||
|
||||
|
||||
elif args.command == 'insmod':
|
||||
modfile = split_into_path_and_file(args.file)
|
||||
print('Uploading \'' + modfile[1])
|
||||
ftp.storbinary("STOR " + modfile[1], file(args.file, "rb"))
|
||||
print(execute_command("insmod /data/video/" + modfile[1]))
|
||||
|
||||
elif args.command == 'upload_file_and_run':
|
||||
# Split filename and path
|
||||
f = split_into_path_and_file(args.file)
|
||||
|
||||
print("Kill running " + f[1] + " and make folder " + args.folder)
|
||||
execute_command("killall -9 " + f[1])
|
||||
sleep(1)
|
||||
execute_command("mkdir -p /data/ftp/" + args.folder)
|
||||
print('Uploading \'' + f[1] + "\' from " + f[0] + " to " + args.folder)
|
||||
ftp.storbinary("STOR " + args.folder + "/" + f[1], file(args.file, "rb"))
|
||||
sleep(0.5)
|
||||
execute_command("chmod 777 /data/ftp/" + args.folder + "/" + f[1])
|
||||
execute_command("/data/ftp/" + args.folder + "/" + f[1] + " > /dev/null 2>&1 &")
|
||||
print("#pragma message: Upload and Start of ap.elf to Bebop Succes!")
|
||||
|
||||
elif args.command == 'upload_file':
|
||||
# Split filename and path
|
||||
f = split_into_path_and_file(args.file)
|
||||
|
||||
execute_command("mkdir -p /data/video/" + args.folder)
|
||||
print('Uploading \'' + f[1] + "\' from " + f[0] + " to /data/video/" + args.folder)
|
||||
ftp.storbinary("STOR " + args.folder + "/" + f[1], file(args.file, "rb"))
|
||||
print("#pragma message: Upload of " + f[1] + " to Bebop Succes!")
|
||||
|
||||
elif args.command == 'download_file':
|
||||
# Split filename and path
|
||||
f = split_into_path_and_file(args.file)
|
||||
# Open file and download
|
||||
try:
|
||||
file = open(args.file, 'wb')
|
||||
print('Downloading \'' + f[1] + "\' from " + args.folder + " to " + f[0])
|
||||
ftp.retrbinary("RETR " + args.folder + "/" + f[1], file.write)
|
||||
print("#pragma message: Download of " + f[1] + " from Bebop Succes!")
|
||||
except IOError:
|
||||
print("#pragma message: Fail to open file " + args.file)
|
||||
except:
|
||||
os.remove(args.file)
|
||||
print("#pragma message: Download of " + f[1] + " from Bebop Failed!")
|
||||
else:
|
||||
file.close()
|
||||
|
||||
elif args.command == 'download_dir':
|
||||
# Split filename and path
|
||||
files = execute_command('find /data/video/' + args.folder + ' -name \'*.*\'')
|
||||
# Create dest dir if needed
|
||||
if not os.path.exists(args.dest):
|
||||
os.mkdir(args.dest)
|
||||
# Open file and download
|
||||
for f in files.split():
|
||||
file_name = split_into_path_and_file(f)
|
||||
file_source = args.folder + '/' + file_name[1]
|
||||
file_dest = args.dest + '/' + file_name[1]
|
||||
try:
|
||||
file = open(file_dest, 'wb')
|
||||
print('Downloading \'' + f + "\' to " + file_dest)
|
||||
ftp.retrbinary("RETR " + file_source, file.write)
|
||||
except IOError:
|
||||
print("#pragma message: Fail to open file " + file_dest)
|
||||
except:
|
||||
os.remove(file_dest)
|
||||
print("#pragma message: Download of " + f + " from Bebop Failed!")
|
||||
else:
|
||||
file.close()
|
||||
print("#pragma message: End download of folder " + args.folder + " from Bebop")
|
||||
|
||||
elif args.command == 'rm_dir':
|
||||
# Split filename and path
|
||||
print("Deleting folder /data/video/" + args.folder + " from Bebop")
|
||||
print(execute_command('rm -r /data/video/' + args.folder))
|
||||
|
||||
|
||||
|
||||
# Close the telnet and python script
|
||||
tn.close()
|
||||
ftp.close()
|
||||
exit(0)
|
||||
@@ -64,7 +64,7 @@ if [ -e $UPDATE_PATH ] ; then
|
||||
|
||||
# Check what to start
|
||||
if [ "$START_PAPARAZZI" = "yes" ] ; then
|
||||
(/data/video/raw/ap.elf; gpio 181 -d ho 1) &
|
||||
(/data/video/paparazzi/ap.elf; gpio 181 -d ho 1) &
|
||||
else
|
||||
(/bin/program.elf ${PELF_ARGS}; gpio 181 -d ho 1) &
|
||||
fi
|
||||
@@ -80,7 +80,7 @@ else
|
||||
if [ "$START_PAPARAZZI" = "yes" ] ; then
|
||||
(/bin/program.elf ${PELF_ARGS}; gpio 181 -d ho 1) &
|
||||
sleep 10
|
||||
(/data/video/raw/ap.elf; gpio 181 -d ho 1) &
|
||||
(/data/video/paparazzi/ap.elf; gpio 181 -d ho 1) &
|
||||
else
|
||||
(/bin/program.elf ${PELF_ARGS}; gpio 181 -d ho 1) &
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user