Ejemplo n.º 1
0
    parser = argparse.ArgumentParser(
        description="MyQ- quadricopter controlled by raspberrypi", epilog="Are U ready to fly?"
    )
    parser.add_argument("-d", dest="debug", action="store_true", help="save debug log: myQ.log ")
    parser.add_argument("-s", dest="savelog", action="store_true", help="save my Q data log: myQ.csv ")
    parser.add_argument("-i", dest="imulog", action="store_true", help="save IMU data log: myQ_sensor.csv")
    parser.add_argument("-ip", dest="ip", action="store", help="set ip addres for netscan")
    parser.add_argument("-c", dest="calibIMU", action="store_true", help="Calibrate IMU")
    parser.add_argument("-n", dest="netscan", action="store_true", help="Start network check")
    parser.add_argument("-w", dest="webserver", action="store_true", help="Start webserver|http//:192.68.0.10/myQ.html")
    args = parser.parse_args()

    # TODO move this options in mode_init

    # init logger
    logger = setupLogger("myQ", args.debug, "myQ.log")
    logger.info("myQ starting...")
    logger.info("Fasten your seat belt")

    # screen = curses.initscr()
    myQ = quadcopter("qpi", pin0=18, pin1=23, pin2=24, pin3=25, simulation=False)
    # GPIO: 18 23 24 25
    # pin : 12 16 18 22

    myQ.imulog = args.imulog
    myQ.savelog = args.savelog
    myQ.calibIMU = args.calibIMU
    myQ.debuglev = args.debug
    myQ.netscanOn = args.netscan  # TODO when fully tested , set  netscan on, by default
    myQ.webserverOn = args.webserver
Ejemplo n.º 2
0
initEsc = False
gpio = 0
parser = argparse.ArgumentParser()
parser.add_argument("gpio",
                    type=int,
                    help='define gpio: 18-23-24-25  pin:12-16-18-22')
parser.add_argument('-i',
                    dest='initEsc',
                    action='store_true',
                    help='Initialize ESC')
args = parser.parse_args()
initEsc = args.initEsc
gpio = args.gpio

logger = setupLogger('myQ')

print('gpio: ' + str(gpio))
print('initEsc: ' + str(initEsc))

mymotor = motor('m1', gpio, simulation=False)
#where 18 is  GPIO18 = pin 12
#GPIO23 = pin 16
#GPIO24 = pin 18
#GPIO25 = pin 22

mySensor = sensor()
mySensor.start()

print('***Press ENTER to start')
res = raw_input()
Ejemplo n.º 3
0
                        action='store_true',
                        help='Calibrate IMU')
    parser.add_argument('-n',
                        dest='netscan',
                        action='store_true',
                        help='Start network check')
    parser.add_argument('-w',
                        dest='webserver',
                        action='store_true',
                        help='Start webserver|http//:192.68.0.10/myQ.html')
    args = parser.parse_args()

    #TODO move this options in mode_init

    #init logger
    logger = setupLogger('myQ', args.debug, 'myQ.log')
    logger.info('myQ starting...')
    logger.info('Fasten your seat belt')

    #screen = curses.initscr()
    myQ = quadcopter('qpi',
                     pin0=18,
                     pin1=23,
                     pin2=24,
                     pin3=25,
                     simulation=False)
    #GPIO: 18 23 24 25
    #pin : 12 16 18 22

    myQ.imulog = args.imulog
    myQ.savelog = args.savelog
Ejemplo n.º 4
0
import argparse
from motor import motor
from sensor import sensor
from loggingQ import setupLogger


initEsc = False
gpio = 0
parser = argparse.ArgumentParser()
parser.add_argument("gpio", type=int, help="define gpio: 18-23-24-25  pin:12-16-18-22")
parser.add_argument("-i", dest="initEsc", action="store_true", help="Initialize ESC")
args = parser.parse_args()
initEsc = args.initEsc
gpio = args.gpio

logger = setupLogger("myQ")

print("gpio: " + str(gpio))
print("initEsc: " + str(initEsc))

mymotor = motor("m1", gpio, simulation=False)
# where 18 is  GPIO18 = pin 12
# GPIO23 = pin 16
# GPIO24 = pin 18
# GPIO25 = pin 22


mySensor = sensor()
mySensor.start()

print("***Press ENTER to start")
Ejemplo n.º 5
0
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.

#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

#    Contact me at:
#    [email protected]
#    solenerotech.wordpress.com
##############################################################################

from netscan import netscan
from loggingQ import setupLogger
from time import time, sleep

logger = setupLogger('myQ', True, 'netscan_log.txt')

myNetscan = netscan(ip='192.168.0.70', timeout=0.5)  # wifi >WP
#myNetscan = netscan(ip='192.168.137.10', timeout=1)  # phoneAP > rpi
#myNetscan.scanAll('192.168.137.')

myNetscan.start()
initTime = time()


try:
    #do something...
    sleep(20)


finally:
Ejemplo n.º 6
0
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

#    Contact me at:
#    [email protected]
#    solenerotech.wordpress.com
##############################################################################

from sensor import sensor
import curses
from loggingQ import setupLogger

import argparse

logger = setupLogger('myQ', True, 'sensor_test.log')

calibIMU = False
parser = argparse.ArgumentParser()
parser.add_argument('-c',
                    dest='calibIMU',
                    action='store_true',
                    help='Calibrate IMU')
parser.add_argument('-i',
                    dest='imulog',
                    action='store_true',
                    help='save IMU data log: myQ_sensor.csv')
args = parser.parse_args()
calibIMU = args.calibIMU
imuLog = args.imulog
Ejemplo n.º 7
0
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

#    Contact me at:
#    [email protected]
#    solenerotech.wordpress.com
##############################################################################

from sensor import sensor
import curses
from loggingQ import setupLogger


import argparse

logger = setupLogger('myQ', True, 'sensor_test.log')

calibIMU = False
parser = argparse.ArgumentParser()
parser.add_argument('-c', dest='calibIMU', action='store_true', help='Calibrate IMU')
parser.add_argument('-i', dest='imulog', action='store_true', help='save IMU data log: myQ_sensor.csv')
args = parser.parse_args()
calibIMU = args.calibIMU
imuLog = args.imulog

mySensor = sensor(imulog=imuLog, simulation=False)

if calibIMU:
    mySensor.calibrate()

mySensor.start()
Ejemplo n.º 8
0
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.

#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

#    Contact me at:
#    [email protected]
#    solenerotech.wordpress.com
##############################################################################

from netscan import netscan
from loggingQ import setupLogger
from time import time, sleep

logger = setupLogger('myQ', True, 'netscan_log.txt')

myNetscan = netscan(ip='192.168.0.70', timeout=0.5)  # wifi >WP
#myNetscan = netscan(ip='192.168.137.10', timeout=1)  # phoneAP > rpi
#myNetscan.scanAll('192.168.137.')

myNetscan.start()
initTime = time()

try:
    #do something...
    sleep(20)

finally:
    # shut down cleanly
    myNetscan.stop()