-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shamima/fall2020/recruitment-challenge/submission #4
Open
Shamima-Ali
wants to merge
6
commits into
master
Choose a base branch
from
feature/Shamima/fall2020/recruitment-challenge
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dd53080
Removed 'all' from README.md
b496ed5
Implemented set_desired_position
Shamima-Ali b76952a
Implemented update_current_position
Shamima-Ali 1a6a117
Added code for navigate
Shamima-Ali f822c5d
Added comments
Shamima-Ali 37d7970
Update navigation.py
Shamima-Ali File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# recruiting-challenges | ||
Repository containing all paradigm student group recruiting challenges. | ||
Repository containing paradigm student group recruiting challenges. | ||
|
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 |
---|---|---|
|
@@ -63,31 +63,68 @@ def __init__(self, GPS, steering): | |
self.current_position = None | ||
self.desired_position = None | ||
|
||
|
||
def set_desired_position(self, desired_position): | ||
""" Sets the desired position the TBM will attempt to move to. | ||
|
||
Note: assume the user will pass in the desired_position parameter when using | ||
the interface | ||
""" | ||
pass | ||
|
||
self.desired_position = desired_position | ||
|
||
def update_current_position(self): | ||
""" Updates the current position of the TBM """ | ||
pass | ||
|
||
GPS.pollSensor() | ||
self.current_position = GPS.getPos() | ||
|
||
def navigate(self): | ||
""" Navigate to the desired position from the current position | ||
|
||
Based on the current position tuple, compared to the desired position tuple, | ||
make decisions on steering, and ensure that the actuations are successful | ||
|
||
Returns: True if actuation requests were successful, False if not | ||
Note: It may be good to notify the user if something unexpected happens! | ||
""" | ||
pass | ||
# Assumption: If any actuation is unsuccessful, the TBM will stop moving | ||
|
||
# These boolean values will indicate whether or not the actuations were suucessful | ||
act_request_forward = False | ||
act_request_right = False | ||
act_request_left = False | ||
act_request_up = False | ||
act_request_down = False | ||
|
||
|
||
#The TBM will move forward as long as the current position is not | ||
#equal to the desired position in the x direction. | ||
if self.desired_position[0] != 0: | ||
while(current_position[0] != desired_position[0]): | ||
act_request_forward = self.steering.move_forward() | ||
self.update_current_position | ||
if act_request_forward == False: | ||
print("Unable to move to desired x position") | ||
self.update_current_position | ||
return current_position == desired_position | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the way you have this, where if actuation fails it will return whether or not we have reached the desired position. Nifty way of doing it! |
||
|
||
|
||
required_y_distance = desired_position[1] - current_position[1] | ||
if required_y_distance > 0: | ||
act_request_right = self.steering.move_right(required_y_distance) | ||
elif required_y_distance < 0: | ||
act_request_left = self.steering.move_left(required_y_distance) | ||
if act_request_left == False or act_request_right == False: | ||
print("Unable to move to desired y position") | ||
self.update_current_position | ||
return current_position == desired_position | ||
|
||
|
||
required_z_distance = desired_position[2] - current_position[2] | ||
if required_z_distance > 0: | ||
act_request_up = self.steering.move_up(required_z_distance) | ||
elif required_z_distance < 0: | ||
act_request_down = self.steering.move_down(required_z_distance) | ||
if act_request_up == False or act_request_down == False: | ||
print("Unable to move to desired z position") | ||
self.update_current_position | ||
return current_position == desired_position | ||
|
||
self.update_current_position | ||
return current_position == desired_position | ||
|
||
|
||
|
||
|
||
# Code below is provided for you, YOU DO NOT NEED TO IMPLEMENT THIS | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it does sound better without
all
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't really mean to make that correction😄 I was just trying out to 'commit' feature on my computer.