Oh and Hello Again, I forgot to mention the major change.
So, instead of each motor handling its own PWM frequency in source along w/ duty_cycle, I had previously a method that handled one value that all motors were being controlled. For instance: def set_motorOne(v1): motor1.set(v1) def set_motorTwo(v2): motor2.set(v2) def set_motorThree(v3): motor3.set(v3) def set_motorFour(v4): motor4.set(v4) app = Flask(__name__) @app.route("/") def homepage(title="homepage"): return render_template("BootGoOne.html", title=title) def add_motors_routeOne(state, v1): @app.route("/" + state, endpoint=state) def handlerOne(): set_motorOne(v1) if add_motors_routeOne == 0: PWM.stop("P9_16") else: pass return homepage(title=state) add_motors_routeOne("0", 0) add_motors_routeOne('40', 40) add_motors_routeOne('50', 50) add_motors_routeOne('60', 60) add_motors_routeOne('70', 70) add_motors_routeOne('80', 80) add_motors_routeOne('90', 90) add_motors_routeOne('100', 100) - The above source handles, what I thought would be, one motor and the peripherals of pwm and gpio. - The below source is what worked w/out the addition of three motors, separate values per motor, and no "failsafe." def set_motors(v1, v2, v3, v4): motor1.set(v1) motor2.set(v2) motor3.set(v3) motor4.set(v4) app = Flask(__name__) @app.route("/") def homepage(title="homepage"): return render_template("BootGoOne.html", title=title) def add_motors_route(state, v1, v2, v3, v4): @app.route("/" + state, endpoint=state) def handlerOne(): set_motors(v1, v2, v3, v4) # if add_motors_routeOne == 0: # PWM.stop("P9_16") else: pass return homepage(title=state) add_motors_route('0', 0) add_motors_route('25', 25) and etc... That is all. Seth On Tuesday, February 2, 2021 at 7:15:43 PM UTC-6 set_ wrote: > Hello, > > Well...when I say working, I mean remedially working. Sysfs did return > errors and I was always receiving the error about multiple values that are > exactly the same. > > I basically changed the source to handle four motors, added a server, and > managed to adopt a "kill switch" in source via the Adafruit_BBIO.PWM > functions and Adafruit_BBIO.GPIO functions. > > Seth > > P.S. One of the four motors seems nice but when I am making a quadruped, > four motors are needed so far. Anyway, do you see an issue w/ the source as > it may be as of now? > > On Tuesday, February 2, 2021 at 7:32:08 AM UTC-6 evilw...@gmail.com wrote: > >> On 2/2/2021 6:20 AM, set_ wrote: >> >> Hello, >> >> I have just come across some issues: >> >> >> - What once worked does not work any longer >> >> What did you do between it working and it not working ? >> >> >> >> - The source has changed a bit but I am receiving an error before the >> changes >> - I have some Python3 source and a server via Flask and HTML >> >> I am giving this source below to better make you understand what is >> happening on my end of the spectrum. Oh and...for some reason, the source >> only allows for non-like numerical values. >> >> uname -a >>> Linux beaglebone 4.19.94-ti-r58 >> cat /etc/dogtag >>> BeagleBoard.org Debian Buster IoT Image 2020-04-06 >> ... >> >> For the uboot_overlay, here is the command to look it over w/ my overlay: >> >> cat /boot/uEnv.txt >>> ###Overide capes with eeprom >> uboot_overlay_addr0=/lib/firmware/BBORG_MOTOR-00A2.dtbo >> >> oh and the source: >> >> #!/usr/bin/python3 >> >> from flask import Flask, render_template >> import Adafruit_BBIO.GPIO as GPIO >> import Adafruit_BBIO.PWM as PWM >> from time import sleep >> >> class Motor: >> def __init__(self, dir_pin, pwm_pin, pwm_freq): >> self.dir_pin = dir_pin >> self.pwm_pin = pwm_pin >> self.value = 0 >> >> PWM.start(pwm_pin, 0, pwm_freq) >> GPIO.setup(dir_pin, GPIO.OUT) >> >> def set(self, value): >> if value == self.value: >> return >> >> assert -100 <= value <= 100 >> >> if (value < 0) != (self.value < 0): >> # changing direction >> PWM.set_duty_cycle(self.pwm_pin, 0) >> GPIO.output(self.dir_pin, value < 0) >> >> PWM.set_duty_cycle(self.pwm_pin, abs(value)) >> self.value = value >> >> motor1 = Motor(dir_pin="P8_18", pwm_pin="P9_16", pwm_freq=1000) >> motor2 = Motor(dir_pin="P8_16", pwm_pin="P9_14", pwm_freq=1000) >> motor3 = Motor(dir_pin="P8_14", pwm_pin="P8_13", pwm_freq=1000) >> motor4 = Motor(dir_pin="P8_26", pwm_pin="P8_19", pwm_freq=1000) >> >> def set_motorOne(v1): >> motor1.set(v1) >> >> def set_motorTwo(v2): >> motor2.set(v2) >> >> def set_motorThree(v3): >> motor3.set(v3) >> >> def set_motorFour(v4): >> motor4.set(v4) >> >> app = Flask(__name__) >> >> @app.route("/") >> def homepage(title="homepage"): >> return render_template("BootGoOne.html", title=title) >> >> def add_motors_routeOne(state, v1): >> @app.route("/" + state, endpoint=state) >> def handlerOne(): >> set_motorOne(v1) >> if add_motors_routeOne == 0: >> PWM.stop("P9_16") >> else: >> pass >> >> return homepage(title=state) >> >> add_motors_routeOne("0", 0) >> add_motors_routeOne('40', 40) >> add_motors_routeOne('50', 50) >> add_motors_routeOne('60', 60) >> add_motors_routeOne('70', 70) >> add_motors_routeOne('80', 80) >> add_motors_routeOne('90', 90) >> add_motors_routeOne('100', 100) >> >> Okay...so: >> >> >> - When I add another 'add_motors_routeOne' as a separate call under >> another motor, I get some odd behavior. >> - For instance, 'add_motors_routeTwo', would begin to make issues >> with calling 'add_motors_routeTwo("0", 0) at the value 0. >> >> Anyway...the issue is that it begins to be a sysfs issue or an assertion >> error on my part. >> >> Traceback (most recent call last): >> File "Moto/motocape/MotorCapeOne/MotorCapeTwo.py", line 92, in >> <module> >> add_motors_routeTwo("0", 0) >> File "Moto/motocape/MotorCapeOne/MotorCapeTwo.py", line 83, in >> add_motors_routeTwo >> @app.route("/" + state, endpoint=state) >> File "/usr/lib/python3/dist-packages/flask/app.py", line 1250, in >> decorator >> self.add_url_rule(rule, endpoint, f, **options) >> File "/usr/lib/python3/dist-packages/flask/app.py", line 66, in >> wrapper_func >> return f(self, *args, **kwargs) >> File "/usr/lib/python3/dist-packages/flask/app.py", line 1221, in >> add_url_rule >> 'existing endpoint function: %s' % endpoint) >> AssertionError: View function mapping is overwriting an existing >> endpoint function: 0 >> >> Above is where you can find my error with the current config. of the >> python3 source from above. >> >> Seth >> >> -- >> For more options, visit http://beagleboard.org/discuss >> --- >> You received this message because you are subscribed to the Google Groups >> "BeagleBoard" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to beagleboard...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/beagleboard/df02989e-74bf-4678-8300-2c7d968b0c3an%40googlegroups.com >> >> <https://groups.google.com/d/msgid/beagleboard/df02989e-74bf-4678-8300-2c7d968b0c3an%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> >> -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/d29b17ec-f3df-4ea0-8a32-c75e38132240n%40googlegroups.com.