Skip to content

Commit

Permalink
activate.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahBarrett98 committed Feb 27, 2021
1 parent 548e68f commit 922cdef
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 42 deletions.
41 changes: 1 addition & 40 deletions Pi/PiBot/PiBot2.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,34 +143,6 @@ def _travel(self, duty, n, pwm_thres, move_f=False, move_b=False):
output.append(self.get_ultrasound())
score = []
t = n / self._us_res # time to sleep per ultrasound reading

# to allow for smooth starting #
"""
if move_b:
L = duty * pwm_thres[0]
R = duty * pwm_thres[1]
# reset duty for both motors
#self.l_pwm.ChangeDutyCycle(0)
#self.r_pwm.ChangeDutyCycle(0)
#GPIO.output(self.GPIO_RIGHT_PWM, True)
#GPIO.output(self.GPIO_LEFT_PWM, True)
for i in range(self._starting_factor-1):
l_p = L / (self._starting_factor - i)
r_p = R / (self._starting_factor - i)
#GPIO.output(self.GPIO_RIGHT_PWM, False)
#GPIO.output(self.GPIO_LEFT_PWM, False)
self.l_pwm.ChangeDutyCycle(l_p)
self.r_pwm.ChangeDutyCycle(r_p)
GPIO.output(self.GPIO_RIGHT_PWM, True)
GPIO.output(self.GPIO_LEFT_PWM, True)
time.sleep(0.0125)
# account for time taken from startup #
t = t - (0.0125*self._starting_factor-1)/self._us_res
else:
# account for time taken from stopping #
t = t - (0.01*self._stopping_factor)/self._us_res
"""

# actual travel time #
for i in range(self._us_res):
# set duty for both motors
Expand All @@ -191,18 +163,7 @@ def _travel(self, duty, n, pwm_thres, move_f=False, move_b=False):
if total_score <= self._min_score:
# if there is not a significant amount of good, make it bad
total_score = -total_score
"""
# to allow for smooth stopping #
if move_f:
l = duty * pwm_thres[0]
r = duty * pwm_thres[1]
for i in range(self._stopping_factor):
l = l/(i+1)
r = r/(i+1)
self.l_pwm.ChangeDutyCycle(l)
self.r_pwm.ChangeDutyCycle(r)
time.sleep(0.01)
"""

# set duty for both motors
self.l_pwm.ChangeDutyCycle(0)
self.r_pwm.ChangeDutyCycle(0)
Expand Down
Binary file modified Pi/PiBot/__pycache__/PiBot2.cpython-37.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions activate.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!bin/bash
cd ./envs/tf2_stable_baselines/bin
source ./activate
source ~/tf2_stable_baselines/bin/activate



0 comments on commit 922cdef

Please sign in to comment.