Skip to content
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

add simple tag direction and distance guesstimator #20

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/Larc2017Simulator.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

984 changes: 984 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def get_position_from_handle(self, handle):
:param handle:
:return:
"""
pos = [[],[]]
pos = [[], []]
_, pos[0] = vrep.simxGetObjectPosition(self.clientID, handle, - 1, vrep.simx_opmode_streaming)
_, pos[1] = vrep.simxGetObjectOrientation(self.clientID, handle, - 1, vrep.simx_opmode_streaming)
return pos
Expand All @@ -121,7 +121,7 @@ def read_sensors(self):
"""
ret = {}
for sensor, handle in self.proximity.items():
_, detectionState, position, _, _ = vrep.simxReadProximitySensor(self.clientID, handle, vrep.simx_opmode_oneshot_wait)
_, detectionState, position, _, _ = vrep.simxReadProximitySensor(self.clientID, handle, vrep.simx_opmode_streaming)
if not detectionState:
position = (0, 0, 0)
distance = sqrt(sum([coord**2 for coord in position]))
Expand Down
Binary file modified larcscene.ttt
Binary file not shown.
47 changes: 47 additions & 0 deletions navigator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

import cv2

class Navigator():

states = ["WHERETHEFUCKAMI",]
Copy link
Member

Choose a reason for hiding this comment

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

srly ?
🙅‍♂️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

=]


def __init__(self, interface):
self.state = self.states[0]
self.interface = interface
self.find_glass = False

def iterate(self, tag_name, tag_angle, tag_distance, sensors, tag_image):
print(self.state, tag_name)
if self.state == "WHERETHEFUCKAMI":

# TODO: replace with a decent controller
if not (tag_name is None):
if tag_name == "Y.png":

# TODO: we need to avoid abruptal direction changes on the wheels, as the
# escs have a required timeout
speed = 1
if tag_angle is not None and tag_angle[0] > 4:
self.interface.set_right_speed(- speed)
self.interface.set_left_speed(speed)
elif tag_angle is not None and tag_angle[0] < -4:
self.interface.set_right_speed(speed)
self.interface.set_left_speed(-speed)
else:
self.interface.set_right_speed(speed)
self.interface.set_left_speed(speed)

if sensors['fr'][0]:
#got to a wall?
#self.state = "GETHEFUCKINGCUP"
pass
print("distance:", tag_distance)
else:
print(tag_name, tag_name is None)
print("FUCK, GOT ", tag_name, tag_name is not None, type(tag_name))
self.state = "GENERALIZEDCHAOS"
self.interface.set_left_speed(0)
self.interface.set_right_speed(0)
cv2.imshow("fail", tag_image)
if self.state == "GETTHEFUCKINGCUP":
print("should be trying to get the cup, now")
Empty file added neural/1
Empty file.
Binary file removed neural/dataset/Y/346.jpg
Binary file not shown.
Binary file removed neural/dataset/Y/442.jpg
Binary file not shown.
Binary file removed neural/dataset/Y/445.jpg
Binary file not shown.
Binary file removed neural/dataset/Y/446.jpg
Binary file not shown.
Binary file removed neural/dataset/Y/447.jpg
Binary file not shown.
Binary file removed neural/dataset/Y/448.jpg
Binary file not shown.
5 changes: 5 additions & 0 deletions neural/model/checkpoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
model_checkpoint_path: "model.ckpt-10000"
all_model_checkpoint_paths: "model.ckpt-1"
all_model_checkpoint_paths: "model.ckpt-5000"
all_model_checkpoint_paths: "model.ckpt-5001"
all_model_checkpoint_paths: "model.ckpt-10000"
Binary file not shown.
Binary file not shown.