######################################################################
# This file copyright the Georgia Institute of Technology
# Permission is given to students to use or modify this file (only)
# to work on their assignments.
Copyright By PowCoder代写 加微信 powcoder
# You may NOT publish this file or make it available to others not in
# the course.
######################################################################
=== Introduction ===
The assignment is broken up into two parts.
Create a SLAM implementation to process a series of landmark measurements (location of tree centers) and movement updates.
The movements are defined for you so there are no decisions for you to make, you simply process the movements
given to you.
Hint: A planner with an unknown number of motions works well with an online version of SLAM.
Here you will create the action planner for the drone. The returned actions will be executed with the goal being to navigate to
and extract the treasure from the environment marked by * while avoiding obstacles (trees).
‘move distance steering’
‘extract treasure_type x_coordinate y_coordinate’
Example Actions:
‘move 1 1.570963’
‘extract * 1.5 -0.2’
Note: All of your estimates should be given relative to your drone’s starting location.
– Start position
– The drone will land at an unknown location on the map, however, you can represent this starting location
as (0,0), so all future drone location estimates will be relative to this starting location.
– Measurements
– Measurements will come from trees located throughout the terrain.
* The format is {‘landmark id’:{‘distance’:0.0, ‘bearing’:0.0, ‘type’:’D’, ‘radius’:0.5}, …}
– Only trees that are within the horizon distance will return measurements. Therefore new trees may appear as you move through the environment.
– Movements
– Action: ‘move 1.0 1.570963’
* The drone will turn counterclockwise 90 degrees [1.57 radians] first and then move 1.0 meter forward.
– Movements are stochastic due to, well, it being a robot.
– If max distance or steering is exceeded, the drone will not move.
– Action: ‘extract * 1.5 -0.2′
* The drone will attempt to extract the specified treasure (*) from the current location of the drone (1.5, -0.2).
– The drone must be within 0.25 distance to successfully extract a treasure.
The drone will always execute a measurement first, followed by an action.
The drone will have a time limit of 10 seconds to find and extract all of the needed treasures.
from typing import Dict, List
# If you see different scores locally and on Gradescope this may be an indication
# that you are uploading a different file than the one you are executing locally.
# If this local ID doesn’t match the ID on Gradescope then you uploaded a different file.
OUTPUT_UNIQUE_FILE_ID = False
if OUTPUT_UNIQUE_FILE_ID:
import hashlib, pathlib
file_hash = hashlib.md5(pathlib.Path(__file__).read_bytes()).hexdigest()
print(f’Unique file ID: {file_hash}’)
class SLAM:
“””Create a basic SLAM module.
def __init__(self):
“””Initialize SLAM components here.
# Provided Functions
def get_coordinates(self):
Retrieves the estimated (x, y) locations in meters of the drone and all landmarks (trees) when called.
Args: None
The (x,y) coordinates in meters of the drone and all landmarks (trees) in the format:
‘self’: (x, y),
‘
‘
def process_measurements(self, measurements: Dict):
Process a new series of measurements and update (x,y) location of drone and landmarks
measurements: Collection of measurements of tree positions and radius
in the format {‘landmark id’:{‘distance’: float
def process_movement(self, distance: float, steering: float):
Process a new movement and update (x,y) location of drone
distance: distance to move in meters
steering: amount to turn in radians
class IndianaDronesPlanner:
Create a planner to navigate the drone to reach and extract the treasure marked by * from an unknown start position while avoiding obstacles (trees).
def __init__(self, max_distance: float, max_steering: float):
Initialize your planner here.
max_distance: the max distance the drone can travel in a single move in meters.
max_steering: the max steering angle the drone can turn in a single move in radians.
def next_move(self, measurements: Dict, treasure_location: Dict):
“””Next move based on the current set of measurements.
measurements: Collection of measurements of tree positions and radius in the format
{‘landmark id’:{‘distance’: float
treasure_location: Location of Treasure in the format {‘x’: float
Return: action: str, points_to_plot: dict [optional]
action (str): next command to execute on the drone.
‘move distance steering’
‘move 1.0 1.570963’ – Turn left 90 degrees and move 1.0 distance.
‘extract treasure_type x_coordinate y_coordinate’
‘extract * 1.5 -0.2’ – Attempt to extract the treasure * from your current location (x = 1.5, y = -0.2).
This will succeed if the specified treasure is within the minimum sample distance.
points_to_plot (dict): point estimates (x,y) to visualize if using the visualization tool [optional]
‘self’ represents the drone estimated position
‘self’: (x, y),
‘
‘
return ”, {}
def who_am_i():
# Please specify your GT login ID in the whoami variable (ex: jsmith322).
whoami = ”
return whoami
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com