Skip to content

Shamima/fall2020/recruitment-challenge/submission #4

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added code for navigate
  • Loading branch information
Shamima-Ali committed Sep 27, 2020
commit 1a6a117d90993ff2a8ce55e21ac3a34afc749724
32 changes: 32 additions & 0 deletions fall-2020/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so you are calling the methods in Steering as if they were static methods. In order to call these, you need to call them from the steering object that is owned by the Navigation class, so this would instead look like:

act_request_forward = self.steering.move_forward()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steering is the class type, I think you mean to refer to the Steering instance that is a class field - "steering"

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, the required distance is negative, indicating you have to move left. However, you are calling move left and passing it this negative value. Depending on the implementation of the move_left method, this could steer the machine right or do nothing. Maybe you can use the abs method to get the magnitude of required_distance.

This comment also applies to the z steering block.

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


Expand Down