Exemplo n.º 1
0
    global target_x
    global target_y

    if event != 4:
        return

    logger.info("Event: %s Flag: %s", event, flag)

    target_x = _x
    target_y = _y


win = cv2.namedWindow("Win")
cv2.setMouseCallback("Win", mouseCallback)

drone = ARDrone(True, True)

# logger.info("Battery Level: %s", drone.get_navdata()[0]['battery'])

try:
    is_flying = False

    kp = 0.2
    kd = 0.1
    ki = 0.0005

    x_pid = PID(Kp=kp, Kd=kd, Ki=ki)
    y_pid = PID(Kp=kp, Kd=kd, Ki=ki)

    angle_pid = PID(Kp=1.5, Kd=0.5, Ki=0.05)
Exemplo n.º 2
0
import logging
from libardrone.libardrone import ARDrone


logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)


drone = ARDrone(True, True)

drone.reset()
drone.halt()
Exemplo n.º 3
0
import logging
from libardrone.libardrone import ARDrone


logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)


drone = ARDrone(True, True)

drone.land()
drone.halt()
logger.info("Halt")
Exemplo n.º 4
0
    global target_x
    global target_y

    if event != 4:
        return

    logger.info("Event: %s Flag: %s", event, flag)

    target_x = _x
    target_y = _y


win = cv2.namedWindow("Win")
cv2.setMouseCallback("Win", mouseCallback)

drone = ARDrone(True, True)

# logger.info("Battery Level: %s", drone.get_navdata()[0]['battery'])

try:
    is_flying = False

    kp = 0.2
    kd = 0.1
    ki = 0.0005

    x_pid = PID(Kp=kp, Kd=kd, Ki=ki)
    y_pid = PID(Kp=kp, Kd=kd, Ki=ki)

    angle_pid = PID(Kp=1.5, Kd=0.5, Ki=0.05)
Exemplo n.º 5
0
import logging
from libardrone.libardrone import ARDrone

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

drone = ARDrone(True, True)

drone.land()
drone.halt()
logger.info("Halt")
# ROS imports
import roslib; roslib.load_manifest('communication'); import rospy
# ROS imports
from libardrone.libardrone import ARDrone
from libardrone.arcommandergui import ARCommanderGUI
from libardrone.rostargetdispatcher import RosTargetDispatcher
from libcom.publishlib import Publisher

""" BASH COMMANDS """
# to view: rosrun image_view image_view image:=/ardrone_video0/image
# to get refreshrate: rostopic hz /ardrone_video0/image

""" initialization """
rospy.init_node("ardrone_data_elf")
publisher = Publisher(True)
drone = ARDrone()
x = y = z = 0
SIMPLEDATA_VARS = ('num_frames', 'battery', 'altitude', 'vx', 'vy', 'vz', 'theta', 'phi', 'psi', 'x', 'y', 'z')
commander = None

""" start commander (optional) """
commander = ARCommanderGUI(drone, draw_vid=True)

""" start ros controller (optional) """
rosTargetDispatcher = RosTargetDispatcher(drone, allow_ros_control = lambda: not commander or commander.allow_ros_control)

""" main loop """
timestamp = None
try:
    while commander == None or commander.is_alive():
        """ calculate time since last iteration """
Exemplo n.º 7
0
import logging
from libardrone.libardrone import ARDrone

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

drone = ARDrone(True, True)

drone.reset()
drone.halt()
# ROS imports
import roslib
roslib.load_manifest('communication')
import rospy
# ROS imports
from libardrone.libardrone import ARDrone
from libardrone.arcommandergui import ARCommanderGUI
from libardrone.rostargetdispatcher import RosTargetDispatcher
from libcom.publishlib import Publisher
""" BASH COMMANDS """
# to view: rosrun image_view image_view image:=/ardrone_video0/image
# to get refreshrate: rostopic hz /ardrone_video0/image
""" initialization """
rospy.init_node("ardrone_data_elf")
publisher = Publisher(True)
drone = ARDrone()
x = y = z = 0
SIMPLEDATA_VARS = ('num_frames', 'battery', 'altitude', 'vx', 'vy', 'vz',
                   'theta', 'phi', 'psi', 'x', 'y', 'z')
commander = None
""" start commander (optional) """
commander = ARCommanderGUI(drone, draw_vid=True)
""" start ros controller (optional) """
rosTargetDispatcher = RosTargetDispatcher(
    drone,
    allow_ros_control=lambda: not commander or commander.allow_ros_control)
""" main loop """
timestamp = None
try:
    while commander == None or commander.is_alive():
        """ calculate time since last iteration """