From dd530808df133535f72c4020d7ef2adf1aa254b3 Mon Sep 17 00:00:00 2001 From: Shamima Ali Date: Sat, 26 Sep 2020 00:55:08 -0230 Subject: [PATCH 1/6] Removed 'all' from README.md git status --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c8a5e2a..87d5872 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # recruiting-challenges -Repository containing all paradigm student group recruiting challenges. +Repository containing paradigm student group recruiting challenges. + From b496ed585bee0685c7aa2ecb3ee86716f1f6c6c3 Mon Sep 17 00:00:00 2001 From: Shamima Ali Date: Sat, 26 Sep 2020 01:44:34 -0230 Subject: [PATCH 2/6] Implemented set_desired_position --- fall-2020/navigation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fall-2020/navigation.py b/fall-2020/navigation.py index 3cdf661..064c0e9 100644 --- a/fall-2020/navigation.py +++ b/fall-2020/navigation.py @@ -70,6 +70,9 @@ def set_desired_position(self, desired_position): Note: assume the user will pass in the desired_position parameter when using the interface """ + + self.desired_position = desired_position + pass From b76952ab7628513313c857237e66f21796e614b2 Mon Sep 17 00:00:00 2001 From: Shamima Ali Date: Sat, 26 Sep 2020 01:46:48 -0230 Subject: [PATCH 3/6] Implemented update_current_position --- fall-2020/navigation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fall-2020/navigation.py b/fall-2020/navigation.py index 064c0e9..5b64f0f 100644 --- a/fall-2020/navigation.py +++ b/fall-2020/navigation.py @@ -78,6 +78,9 @@ def set_desired_position(self, desired_position): def update_current_position(self): """ Updates the current position of the TBM """ + GPS.pollSensor + self.current_position = GPS.getPos + pass From 1a6a117d90993ff2a8ce55e21ac3a34afc749724 Mon Sep 17 00:00:00 2001 From: Shamima Ali Date: Sun, 27 Sep 2020 01:04:42 -0230 Subject: [PATCH 4/6] Added code for navigate --- fall-2020/navigation.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/fall-2020/navigation.py b/fall-2020/navigation.py index 5b64f0f..73fb5e4 100644 --- a/fall-2020/navigation.py +++ b/fall-2020/navigation.py @@ -93,6 +93,38 @@ def navigate(self): Returns: True if actuation requests were successful, False if not Note: It may be good to notify the user if something unexpected happens! """ + act_request_forward = True + act_request_right = True + act_request_left = True + act_request_up = True + act_request_down = True + + if desired_position[0] > current_position[0]: + while(current_position[0] != desired_position[0]): + act_request_forward = Steering.move_forward() + self.update_current_position + if act_request_forward == False: + print("Unable to move to desired x position") + + required_y_distance = desired_position[1] - current_position[1] + if required_y_distance > 0: + act_request_right = Steering.move_right(required_y_distance) + elif required_y_distance < 0: + act_request_left = Steering.move_left(required_y_distance) + if act_request_left or act_request_left == False: + print("Unable to move to desired y position") + + required_z_distance = desired_position[2] - current_position[2] + if required_z_distance > 0: + act_request_up = Steering.move_up(required_z_distance) + elif required_z_distance < 0: + act_request_down = Steering.move_down(required_z_distance) + if act_request_up or act_request_down == False: + print("Unable to move to desired z position") + + self.update_current_position + return current_position == desired_position + pass From f822c5dae8d5f4cf1309a2f88cb1ce08ab948ee4 Mon Sep 17 00:00:00 2001 From: Shamima Ali Date: Wed, 30 Sep 2020 01:17:25 -0230 Subject: [PATCH 5/6] Added comments --- fall-2020/navigation.py | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/fall-2020/navigation.py b/fall-2020/navigation.py index 73fb5e4..d66f192 100644 --- a/fall-2020/navigation.py +++ b/fall-2020/navigation.py @@ -85,42 +85,49 @@ def update_current_position(self): 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! - """ + """ 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 = True - act_request_right = True - act_request_left = True - act_request_up = True - act_request_down = True + act_request_right = True + act_request_left = True + act_request_up = True + act_request_down = True + - if desired_position[0] > current_position[0]: + """"The TBM will move forward as long as the current position is not + equal to the desired position in the x direction. """ + if desired_position[0] != 0: while(current_position[0] != desired_position[0]): act_request_forward = 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 + + required_y_distance = desired_position[1] - current_position[1] if required_y_distance > 0: act_request_right = Steering.move_right(required_y_distance) elif required_y_distance < 0: act_request_left = Steering.move_left(required_y_distance) - if act_request_left or act_request_left == False: + 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 = Steering.move_up(required_z_distance) elif required_z_distance < 0: act_request_down = Steering.move_down(required_z_distance) - if act_request_up or act_request_down == False: - print("Unable to move to desired z position") + 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 From 37d7970e2f2ea13d3df2e015cf2cf30bedc3c230 Mon Sep 17 00:00:00 2001 From: Shamima Ali <71805264+Shamima-Ali@users.noreply.github.com> Date: Wed, 4 Nov 2020 13:37:30 -0330 Subject: [PATCH 6/6] Update navigation.py Thanks for taking the time to review the code. I made the changes as requested. --- fall-2020/navigation.py | 46 +++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/fall-2020/navigation.py b/fall-2020/navigation.py index d66f192..6063833 100644 --- a/fall-2020/navigation.py +++ b/fall-2020/navigation.py @@ -63,44 +63,36 @@ 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 """ - self.desired_position = desired_position - - pass - def update_current_position(self): """ Updates the current position of the TBM """ - GPS.pollSensor - self.current_position = GPS.getPos - - pass - + GPS.pollSensor() + self.current_position = GPS.getPos() def navigate(self): - """ 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 = True - act_request_right = True - act_request_left = True - act_request_up = True - act_request_down = True + # 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 desired_position[0] != 0: + #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 = Steering.move_forward() + act_request_forward = self.steering.move_forward() self.update_current_position if act_request_forward == False: print("Unable to move to desired x position") @@ -110,9 +102,9 @@ def navigate(self): required_y_distance = desired_position[1] - current_position[1] if required_y_distance > 0: - act_request_right = Steering.move_right(required_y_distance) + act_request_right = self.steering.move_right(required_y_distance) elif required_y_distance < 0: - act_request_left = Steering.move_left(required_y_distance) + 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 @@ -121,9 +113,9 @@ def navigate(self): required_z_distance = desired_position[2] - current_position[2] if required_z_distance > 0: - act_request_up = Steering.move_up(required_z_distance) + act_request_up = self.steering.move_up(required_z_distance) elif required_z_distance < 0: - act_request_down = Steering.move_down(required_z_distance) + 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 @@ -132,7 +124,7 @@ def navigate(self): self.update_current_position return current_position == desired_position - pass + # Code below is provided for you, YOU DO NOT NEED TO IMPLEMENT THIS