Skip to content
Merged
Changes from all commits
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
10 changes: 6 additions & 4 deletions demo/EXPLOR3R/auto-drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
ir = InfraredSensor(); assert ir.connected
ts = TouchSensor(); assert ts.connected

print('Robot Starting')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since this is a demo, we could use this as an opportunity to demonstrate espeak functionality, and change the line to

Sound.speak('Robot starting').wait()

It will also be easier to notice when launched from brickman interface.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is there a demo somewhere on how to vim a .sh file and chmod + x it so it can be launched? Or is there some other way to make these scripts executable on the brickman?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It not, it would be a valuable edition to the readme.

@ddemidov ddemidov Nov 8, 2016

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There could be something about it here:
https://sites.google.com/site/ev3python/putty

EDIT: wrong link

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since this is a demo, we could use this as an opportunity to demonstrate espeak functionality, and change the line to

I can't say I'm particularly excited to talk at people every time they start his robot, but I suppose it could be a good way to help people discover this functionality.

Is there a demo somewhere on how to vim a .sh file and chmod + x it so it can be launched? Or is there some other way to make these scripts executable on the brickman?

I believe the README has a section on preparing Python files for execution.


# We will need to check EV3 buttons state.
btn = Button()

Expand Down Expand Up @@ -76,7 +78,7 @@ def backup():
# until both motors are stopped before continuing.
for m in motors:
m.stop(stop_action='brake')
m.run_timed(duty_cycle_sp=-50, time_sp=1500)
m.run_timed(speed_sp=-500, time_sp=1500)

# When motor is stopped, its `state` attribute returns empty list.
# Wait until both motors are stopped:
Expand All @@ -99,7 +101,7 @@ def turn():
t = randint(250, 750)

for m, p in zip(motors, power):
m.run_timed(duty_cycle_sp=p*75, time_sp=t)
m.run_timed(speed_sp = p * 750, time_sp = t)

# Wait until both motors are stopped:
while any(m.state for m in motors):
Expand All @@ -122,10 +124,10 @@ def turn():

if distance > 60:
# Path is clear, run at full speed.
dc = 90
dc = 95
else:
# Obstacle ahead, slow down.
dc = 40
dc = 30

for m in motors:
m.duty_cycle_sp = dc
Expand Down