Ejemplo n.º 1
0
def pg_user(request, new_delivery):
    delivery_queue.append(new_delivery)

    lat, lon = ast.literal_eval(new_delivery)

    rospy.init_node("land_test")
    pv = velocity_goto.posVel(copter_id="1")
    pv.start_subs()
    pv.subscribe_pose_thread()
    time.sleep(0.1)
    pv.start_navigating()
    time.sleep(0.1)
    print "set mode"
    time.sleep(0.5)
    pv.setmode(custom_mode="")
    time.sleep(2.0)
    pv.arm()
    #out = raw_input()
    time.sleep(2.0)
    pv.setmode(custom_mode="OFFBOARD")
    pv.takeoff_velocity(alt=6.0)
    time.sleep(0.5)
    print "out of takeoff"
    utm_coords = utm.from_latlon(lat, lon)
    #utm_coords = utm.from_latlon(37.873308606981595,-122.30257440358399) #(37.87328$
    print "going to gps", utm_coords, "current: ", pv.get_lat_lon_alt()
    pv.update(utm_coords[0], utm_coords[1], 7.0)
    #pv.update(pv.cur_pos_x, pv.cur_pos_y, 7.0)
    pv.setmode(custom_mode="OFFBOARD")
    while not pv.reached:
        time.sleep(0.025)
    #print out
    print "at gps, waiting"
    #time.sleep(2.0)
    print "done"
    #pv.land_velocity()
    pv.setmode(custom_mode="AUTO.LAND")
    #copters = [pv]
    #velocity_goto.SmartRTL(copters)
    #pv.land_velocity()
    print "Landed!"

    #bc.make_delivery(lat,lon)

    return 'Delivering to coordinates %s!' % (new_delivery, )
Ejemplo n.º 2
0
from threading import Thread

import time
import ast
import os

import velocity_goto

is_test = False

if True:
    rospy.init_node("killer")
    print "initializing copter..."

    cop = velocity_goto.posVel(copter_id = "1")


if is_test:
    
    cop.start_subs()
    time.sleep(1.0)

    cop.subscribe_pose_thread()
    time.sleep(0.1)
    
    cop.start_navigating()
    time.sleep(0.1)

    cop.setmode(custom_mode = "OFFBOARD")
    cop.arm()
Ejemplo n.º 3
0
        self.y_offset = -self.stick_map[2]
        self.z_offset = self.stick_map[0]

    def handle_buttons(self, msg):
        self.butt = msg

    def start_subbing(self):
        stick_sub = rospy.Subscriber("sticks", std_msgs.msg.String,
                                     self.handle_sticks)
        button_sub = rospy.Subscriber("unused_buttons", std_msgs.msg.String,
                                      self.handle_buttons)


print "initializing copter..."

cop = velocity_goto.posVel(copter_id="1")

cop.start_subs()
time.sleep(1.0)

cop.subscribe_pose_thread()
time.sleep(0.1)

cop.start_navigating()
time.sleep(0.1)

cop.setmode(custom_mode="OFFBOARD")
cop.arm()
time.sleep(0.1)

cop.takeoff_velocity()
Ejemplo n.º 4
0
    def start_subbing(self):
        stick_sub = rospy.Subscriber("sticks", std_msgs.msg.String,
                                     self.handle_sticks)


rospy.init_node("copter_broadcast_frames")
#br = tf.TransformBroadcaster() #test

print "initializing copter..."

cops = []

for i in range(4):
    print str(i + 1)
    cops.append(velocity_goto.posVel(copter_id=str(i + 1)))

for cop in cops:
    cop.start_subs()
    time.sleep(1.0)

    cop.subscribe_pose_thread()
    time.sleep(0.1)

    cop.start_navigating()
    time.sleep(0.1)

print "taking off"

i = 1
Ejemplo n.º 5
0
        self.click = ""

    def handle_buttons(self, msg):
        self.click = str(msg)[6:]

    def start_subbing(self):
        button_sub = rospy.Subscriber("unused_buttons", std_msgs.msg.String, self.handle_buttons)

rospy.init_node("copter_broadcast_frames")

print "Please wait while the copters warm up..."

cops = []

for i in range(5):
    cops.append(velocity_goto.posVel(copter_id = str(i+1)))

for cop in cops:
    cop.start_subs()
    time.sleep(1.0)

    cop.subscribe_pose_thread()
    time.sleep(0.1)

    cop.start_navigating()
    time.sleep(0.1)

i = 1

b = buttons()
b.start_subbing()
Ejemplo n.º 6
0
import time
import rospy
import velocity_goto

print "initializing copters..."

cops = []

for i in range(4):
    cop_num = str(i+1)
    cops.append(velocity_goto.posVel(copter_id = cop_num))

    cops[i].start_subs()
    cops[i].subscribe_pose_thread()

    time.sleep(0.1)

    cops[i].start_navigating()

    time.sleep(0.1)

print "arming copters..."

for c in cops:
    c.setmode(custom_mode = "OFFBOARD")
    c.arm()

    time.sleep(0.1)