def ardrone2_install_vision(): print('Uploading GST') parrot_utils.uploadfile(ftp, "arm_light.tgz", file("bin/arm_light.tgz", "rb")) print(parrot_utils.execute_command(tn,"cd /data/video && tar -xzf arm_light.tgz")) print(parrot_utils.execute_command(tn,"rm -rf /data/video/arm_light.tgz")) print('Now Starting Vision') ardrone2_start_vision()
def ardrone2_install_network_script(): print('Uploading Wifi script') parrot_utils.uploadfile(ftp, "wifi_setup.sh", file("ardrone2/wifi_setup.sh", "rb")) print( parrot_utils.execute_command( tn, "mv /data/video/wifi_setup.sh /bin/wifi_setup.sh")) print(parrot_utils.execute_command(tn, "chmod 777 /bin/wifi_setup.sh"))
def ardrone2_install_autoboot(): print('Uploading autoboot script') parrot_utils.uploadfile(ftp, "check_update.sh", file("ardrone2/check_update.sh", "rb")) print( parrot_utils.execute_command( tn, "mv /data/video/check_update.sh /bin/check_update.sh")) print(parrot_utils.execute_command(tn, "chmod 777 /bin/check_update.sh"))
def ardrone2_install_olsrd(): print('Uploading olsr deamon') parrot_utils.uploadfile(ftp, "olsrd", file("ardrone2/olsrd", "rb")) parrot_utils.uploadfile(ftp, "olsrd.conf", file("ardrone2/olsrd.conf", "rb")) print(parrot_utils.execute_command(tn,"mv /data/video/olsrd /bin/olsrd")) print(parrot_utils.execute_command(tn,"chmod 777 /bin/olsrd")) print(parrot_utils.execute_command(tn,"mkdir -p /etc/olsrd")) print(parrot_utils.execute_command(tn,"mv /data/video/olsrd.conf /etc/olsrd")) print(parrot_utils.execute_command(tn,"rm -f /var/run && ln -s /tmp /var/run")) # olsrd needs /var/run folder, symlinked to /tmp
def ardrone2_install_vision(): print('Uploading GST') parrot_utils.uploadfile(ftp, "arm_light.tgz", file("bin/arm_light.tgz", "rb")) print( parrot_utils.execute_command( tn, "cd /data/video && tar -xzf arm_light.tgz")) print(parrot_utils.execute_command(tn, "rm -rf /data/video/arm_light.tgz")) print('Now Starting Vision') ardrone2_start_vision()
def ardrone2_install_olsrd(): print('Uploading olsr deamon') parrot_utils.uploadfile(ftp, "olsrd", file("ardrone2/olsrd", "rb")) parrot_utils.uploadfile(ftp, "olsrd.conf", file("ardrone2/olsrd.conf", "rb")) print(parrot_utils.execute_command(tn, "mv /data/video/olsrd /bin/olsrd")) print(parrot_utils.execute_command(tn, "chmod 777 /bin/olsrd")) print(parrot_utils.execute_command(tn, "mkdir -p /etc/olsrd")) print( parrot_utils.execute_command(tn, "mv /data/video/olsrd.conf /etc/olsrd")) print( parrot_utils.execute_command(tn, "rm -f /var/run && ln -s /tmp /var/run") ) # olsrd needs /var/run folder, symlinked to /tmp
# Kill a program elif args.command == 'kill': parrot_utils.execute_command(tn, 'killall -9 ' + args.program) print('Program "' + args.program + '" is now killed') # Start a program elif args.command == 'start': parrot_utils.execute_command(tn, args.start + ' &') print('Program "' + args.start + '" is now started') elif args.command == 'insmod': modfile = parrot_utils.split_into_path_and_file(args.file) print('Uploading \'' + modfile[1]) parrot_utils.uploadfile(ftp, modfile[1], file(args.file, "rb")) print(parrot_utils.execute_command(tn, "insmod /data/ftp/" + modfile[1])) elif args.command == 'upload_file_and_run': # Split filename and path f = parrot_utils.split_into_path_and_file(args.file) #check firmware version v = parrot_utils.check_version(tn, '').strip() print("Checking Bebop firmware version... " + v ) if ((v < '3.2.0') or (v > '3.4.0-RC2')): print("Error: please upgrade your Bebop firmware to version between 3.2.0 and 3.4.0!") else: print("Kill running " + f[1] + " and make folder " + args.folder) parrot_utils.execute_command(tn,"killall -9 " + f[1]) sleep(1)
def ardrone2_install_network_script(): print('Uploading Wifi script') parrot_utils.uploadfile(ftp, "wifi_setup.sh", file("ardrone2/wifi_setup.sh", "rb")) print(parrot_utils.execute_command(tn,"mv /data/video/wifi_setup.sh /bin/wifi_setup.sh")) print(parrot_utils.execute_command(tn,"chmod 777 /bin/wifi_setup.sh"))
def ardrone2_install_autoboot(): print('Uploading autoboot script') parrot_utils.uploadfile(ftp, "check_update.sh", file("ardrone2/check_update.sh", "rb")) print(parrot_utils.execute_command(tn,"mv /data/video/check_update.sh /bin/check_update.sh")) print(parrot_utils.execute_command(tn,"chmod 777 /bin/check_update.sh"))