This repository has been archived by the owner on May 11, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,991 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
import time | ||
import config | ||
import sys | ||
import os | ||
import yaml | ||
import math | ||
|
||
from drone import Drone | ||
from robot import Robot | ||
|
||
def execute(robot): | ||
try: | ||
mylist = [] | ||
myvelocity = [] | ||
robot.take_off() | ||
while True: | ||
mylist.insert(0, robot.detect_object("red")) | ||
size = mylist[0][0] | ||
x = mylist[0][1] | ||
y = mylist[0][2] | ||
if size > 0: | ||
if size > 700: | ||
velx = '-2' | ||
else: | ||
velx = '2' | ||
|
||
if x > 165: | ||
velyaw = '-2' | ||
else: | ||
velyaw = '2' | ||
|
||
if y > 110: | ||
velz = '-1' | ||
else: | ||
velz = '1' | ||
|
||
else: | ||
robot.stop() | ||
velx = '0' | ||
velz = '0' | ||
velyaw = '2' | ||
|
||
myvelocity.insert(0, velx) | ||
myvelocity.insert(1, velz) | ||
myvelocity.insert(2, velyaw) | ||
robot.move_vector(myvelocity) | ||
|
||
except KeyboardInterrupt: | ||
raise | ||
|
||
if __name__ == '__main__': | ||
if len(sys.argv) == 2: | ||
path = os.getcwd() | ||
open_path = path+'/' | ||
filename = sys.argv[1] | ||
|
||
else: | ||
sys.exit("ERROR: Example:python my_generated_script.py cfgfile.yml") | ||
|
||
# loading parameters | ||
if os.path.isabs(filename): | ||
stream = open(filename, "r") | ||
cfg = config.load(filename) | ||
else: | ||
stream = open(open_path + filename, "r") | ||
cfg = config.load(open_path + filename) | ||
yml_file = yaml.load(stream) | ||
|
||
for section in yml_file: | ||
if section == 'drone': | ||
#TODO | ||
robot = Drone(cfg) | ||
|
||
break | ||
elif section == 'robot': | ||
robot = Robot(cfg) | ||
|
||
break | ||
# executing the scratch program | ||
execute(robot) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
import time | ||
import config | ||
import sys | ||
import comm | ||
import os | ||
import yaml | ||
import math | ||
|
||
from drone import Drone | ||
from robot import Robot | ||
|
||
def execute(robot): | ||
try: | ||
mylist2 = [] | ||
mylist = [] | ||
mylist2.append('0') | ||
mylist2.append('0') | ||
mylist2.append('-2') | ||
mylist.append('0') | ||
mylist.append('0') | ||
mylist.append('2') | ||
robot.take_off() | ||
time.sleep(1) | ||
robot.move_vector(mylist) | ||
time.sleep(3) | ||
robot.stop() | ||
time.sleep(1) | ||
robot.move_vector(mylist2) | ||
time.sleep(3) | ||
robot.stop() | ||
time.sleep(1) | ||
robot.land() | ||
time.sleep(1) | ||
except KeyboardInterrupt: | ||
raise | ||
|
||
if __name__ == '__main__': | ||
if len(sys.argv) == 2: | ||
path = os.getcwd() | ||
open_path = path+'/' | ||
filename = sys.argv[1] | ||
|
||
else: | ||
sys.exit("ERROR: Example:python my_generated_script.py cfgfile.yml") | ||
|
||
# loading parameters | ||
if os.path.isabs(filename): | ||
stream = open(filename, "r") | ||
cfg = config.load(filename) | ||
else: | ||
stream = open(open_path + filename, "r") | ||
cfg = config.load(open_path + filename) | ||
yml_file = yaml.load(stream) | ||
|
||
for section in yml_file: | ||
if section == 'drone': | ||
# creating the object | ||
robot = Drone(cfg) | ||
|
||
break | ||
elif section == 'robot': | ||
# creating the object | ||
|
||
robot = Robot(cfg) | ||
|
||
break | ||
# executing the scratch program | ||
execute(robot) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
import time | ||
import config | ||
import sys | ||
import os | ||
import yaml | ||
import math | ||
|
||
from drone import Drone | ||
from robot import Robot | ||
|
||
def execute(robot): | ||
try: | ||
mylist = [] | ||
myvelocity = [] | ||
robot.take_off() | ||
while True: | ||
mylist.insert(0, robot.detect_object("red")) | ||
size = mylist[0][0] | ||
x = mylist[0][1] | ||
y = mylist[0][2] | ||
if size > 0: | ||
if size > 700: | ||
velx = '-2' | ||
else: | ||
velx = '2' | ||
|
||
if x > 165: | ||
velyaw = '-2' | ||
else: | ||
velyaw = '2' | ||
|
||
if y > 110: | ||
velz = '-1' | ||
else: | ||
velz = '1' | ||
|
||
else: | ||
robot.stop() | ||
velx = '0' | ||
velz = '0' | ||
velyaw = '2' | ||
|
||
myvelocity.insert(0, velx) | ||
myvelocity.insert(1, velz) | ||
myvelocity.insert(2, velyaw) | ||
robot.move_vector(myvelocity) | ||
|
||
except KeyboardInterrupt: | ||
raise | ||
|
||
if __name__ == '__main__': | ||
if len(sys.argv) == 2: | ||
path = os.getcwd() | ||
open_path = path+'/' | ||
filename = sys.argv[1] | ||
|
||
else: | ||
sys.exit("ERROR: Example:python my_generated_script.py cfgfile.yml") | ||
|
||
# loading parameters | ||
if os.path.isabs(filename): | ||
stream = open(filename, "r") | ||
cfg = config.load(filename) | ||
else: | ||
stream = open(open_path + filename, "r") | ||
cfg = config.load(open_path + filename) | ||
yml_file = yaml.load(stream) | ||
|
||
for section in yml_file: | ||
if section == 'drone': | ||
#TODO | ||
robot = Drone(cfg) | ||
|
||
break | ||
elif section == 'robot': | ||
robot = Robot(cfg) | ||
|
||
break | ||
# executing the scratch program | ||
execute(robot) | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
import time | ||
import config | ||
import sys | ||
import os | ||
import yaml | ||
import math | ||
|
||
from drone import Drone | ||
from robot import Robot | ||
|
||
def execute(robot): | ||
try: | ||
while True: | ||
robot.move("forward", 2) | ||
time.sleep(5) | ||
robot.stop() | ||
time.sleep(1) | ||
robot.move("back", 2) | ||
time.sleep(5) | ||
robot.stop() | ||
time.sleep(1) | ||
robot.turn("left", 0.5) | ||
time.sleep(2) | ||
robot.stop() | ||
time.sleep(1) | ||
robot.turn("right", 0.5) | ||
time.sleep(2) | ||
robot.stop() | ||
time.sleep(1) | ||
|
||
except KeyboardInterrupt: | ||
raise | ||
|
||
if __name__ == '__main__': | ||
if len(sys.argv) == 2: | ||
path = os.getcwd() | ||
open_path = path+'/' | ||
filename = sys.argv[1] | ||
|
||
else: | ||
sys.exit("ERROR: Example:python my_generated_script.py cfgfile.yml") | ||
|
||
# loading parameters | ||
if os.path.isabs(filename): | ||
stream = open(filename, "r") | ||
cfg = config.load(filename) | ||
else: | ||
stream = open(open_path + filename, "r") | ||
cfg = config.load(open_path + filename) | ||
yml_file = yaml.load(stream) | ||
|
||
for section in yml_file: | ||
if section == 'drone': | ||
#TODO | ||
robot = Drone(cfg) | ||
|
||
break | ||
elif section == 'robot': | ||
robot = Robot(cfg) | ||
|
||
break | ||
# executing the scratch program | ||
execute(robot) | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0"?> | ||
|
||
<robot name="quadrotor" | ||
xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor" | ||
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller" | ||
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface" | ||
xmlns:xacro="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"> | ||
|
||
<!-- Included URDF Files --> | ||
<include filename="$(find cvg_sim_gazebo)/urdf/quadrotor_base.urdf.xacro" /> | ||
|
||
<!-- Instantiate quadrotor_base_macro once (has no parameters atm) --> | ||
<quadrotor_base_macro /> | ||
|
||
</robot> |
Oops, something went wrong.