Coder Social home page Coder Social logo

Comments (3)

jharris1993 avatar jharris1993 commented on June 10, 2024

from gopigo3.

slowrunner avatar slowrunner commented on June 10, 2024

Fastest GoPiGo3 on Record (9.3m/s)

Confirmed also happens on a 7 year old GoPiGo3 (Carl) - reports traveling at 20 miles per hour briefly!
(Wheels actually flinched a little)

pi@Carl:~/Carl $ python3 ~/Dexter/GoPiGo3/Software/Python/Examples/Read_Info.py 
Manufacturer    :  Dexter Industries
Board           :  GoPiGo3
Serial Number   :  BA93EB4F514E3437324A2020FF040B1F
Hardware version:  3.x.x
Firmware version:  1.0.0
Battery voltage :  10.871
5v voltage      :  5.067

To Reproduce:

  1. drive GoPiGo a little to ensure non-zero encoders
  2. start read_motor_status.py in background
  • Prints initial motor_status
  • Loops at 100 Hz checking for non-zero read_motor_status().dps
    • prints motor status until DPS zero again
  1. run reset_encoders.py in foreground
pi@Carl:~/Carl/systests/fictionaldps $ ./read_motor_status.py &
[1] 26443
pi@Carl:~/Carl/systests/fictionaldps $ 
2024-05-17 22:47:34.018234: lSpeed,rSpeed: (0.000,0.000  lEncoder,rEncoder: (45349,-47045)  lPwr,rPwr: (-28,-28)

pi@Carl:~/Carl/systests/fictionaldps $ ./reset_encoders.py 
2024-05-17 22:47:44.488092: resetting encoders

2024-05-17 22:47:44.502749: lSpeed,rSpeed: (-16100.000,-134.000  lEncoder,rEncoder: (0,0)  lPwr,rPwr: (70,70)

2024-05-17 22:47:44.514082: lSpeed,rSpeed: (-16095.000,-130.000  lEncoder,rEncoder: (0,0)  lPwr,rPwr: (-7,-7)

2024-05-17 22:47:44.525271: lSpeed,rSpeed: (-16095.000,-125.000  lEncoder,rEncoder: (0,1)  lPwr,rPwr: (-2,-9)
pi@Carl:~/Carl/systests/fictionaldps $ 
2024-05-17 22:47:44.536336: lSpeed,rSpeed: (-16090.000,-120.000  lEncoder,rEncoder: (1,1)  lPwr,rPwr: (-4,-6)

2024-05-17 22:47:44.547352: lSpeed,rSpeed: (-16090.000,-120.000  lEncoder,rEncoder: (1,1)  lPwr,rPwr: (-4,-6)

2024-05-17 22:47:44.558347: lSpeed,rSpeed: (-16090.000,-125.000  lEncoder,rEncoder: (1,0)  lPwr,rPwr: (-4,1)

2024-05-17 22:47:44.569368: lSpeed,rSpeed: (-16090.000,-125.000  lEncoder,rEncoder: (1,0)  lPwr,rPwr: (-4,-4)

2024-05-17 22:47:44.580344: lSpeed,rSpeed: (-16090.000,-120.000  lEncoder,rEncoder: (1,1)  lPwr,rPwr: (-4,-11)

2024-05-17 22:47:44.591312: lSpeed,rSpeed: (-16090.000,-125.000  lEncoder,rEncoder: (1,0)  lPwr,rPwr: (-4,1)

2024-05-17 22:47:44.602348: lSpeed,rSpeed: (9.000,9.000  lEncoder,rEncoder: (1,0)  lPwr,rPwr: (-4,-4)

2024-05-17 22:47:44.613317: lSpeed,rSpeed: (4.000,4.000  lEncoder,rEncoder: (1,0)  lPwr,rPwr: (-4,-4)

2024-05-17 22:47:44.624303: lSpeed,rSpeed: (4.000,0.000  lEncoder,rEncoder: (1,0)  lPwr,rPwr: (-4,-4)

2024-05-17 22:47:44.635285: lSpeed,rSpeed: (0.000,-4.000  lEncoder,rEncoder: (1,0)  lPwr,rPwr: (-4,-4)

2024-05-17 22:47:44.646332: lSpeed,rSpeed: (0.000,-4.000  lEncoder,rEncoder: (1,0)  lPwr,rPwr: (-4,-4)

2024-05-17 22:47:44.657309: lSpeed,rSpeed: (0.000,-4.000  lEncoder,rEncoder: (1,0)  lPwr,rPwr: (-4,-4)

2024-05-17 22:47:44.668298: lSpeed,rSpeed: (0.000,0.000  lEncoder,rEncoder: (1,0)  lPwr,rPwr: (-4,-4)

read_motor_status.py:

#!/usr/bin/env python3

import gopigo3
import datetime as dt
import time

DT_FORMAT = "%Y-%m-%d %H:%M:%S.%f"
def main():
    try:
        gpg = gopigo3.GoPiGo3()
        lF,lP,lE,lDPS = gpg.get_motor_status(gpg.MOTOR_LEFT)
        rF,rP,rE,rDPS = gpg.get_motor_status(gpg.MOTOR_RIGHT)
        tnow = dt.datetime.now().strftime(DT_FORMAT)
        print_msg="\n{}: lSpeed,rSpeed: ({:.3f},{:.3f}  lEncoder,rEncoder: ({},{})  lPwr,rPwr: ({},{})".format(tnow,lDPS,rDPS,lE,rE
,lP,rP)
        print(print_msg)

        while True:
            lF,lP,lE,lDPS = gpg.get_motor_status(gpg.MOTOR_LEFT)
            rF,rP,rE,rDPS = gpg.get_motor_status(gpg.MOTOR_RIGHT)
            tnow = dt.datetime.now().strftime(DT_FORMAT)
            if (abs(rDPS) > 0 or abs(lDPS) > 0):
                print_msg="\n{}: lSpeed,rSpeed: ({:.3f},{:.3f}  lEncoder,rEncoder: ({},{})  lPwr,rPwr: ({},{})".format(tnow,lDPS,rD
PS,lE,rE,lP,rP)
                print(print_msg)
                time.sleep(0.01)
                lF,lP,lE,lDPS = gpg.get_motor_status(gpg.MOTOR_LEFT)
                rF,rP,rE,rDPS = gpg.get_motor_status(gpg.MOTOR_RIGHT)
                tnow = dt.datetime.now().strftime(DT_FORMAT)
                print_msg="\n{}: lSpeed,rSpeed: ({:.3f},{:.3f}  lEncoder,rEncoder: ({},{})  lPwr,rPwr: ({},{})".format(tnow,lDPS,rD
PS,lE,rE,lP,rP)
                print(print_msg)
            time.sleep(0.01)
    except KeyboardInterrupt:
        pass


if __name__ == '__main__':
    main()

reset_encoders.py:

#!/usr/bin/env python3

import gopigo3
import datetime as dt
import time

DT_FORMAT = "%Y-%m-%d %H:%M:%S.%f"
def main():
    try:
        gpg = gopigo3.GoPiGo3()
        tnow = dt.datetime.now().strftime(DT_FORMAT)
        print("{}: resetting encoders".format(tnow))
        gpg.reset_motor_encoder(gpg.MOTOR_LEFT + gpg.MOTOR_RIGHT)
    except KeyboardInterrupt:
        pass


if __name__ == '__main__':
    main()

from gopigo3.

slowrunner avatar slowrunner commented on June 10, 2024

Interestingly, using the EasyGoPiGo3.reset_encoders() method fictional speeds are reported but the power is set and maintained at 0, so using this method instead of reset_motor_encoder() does not cause the GoPiGo3 to flinch, (and allows my "is_moving" test to ignore the non-zero speeds if the power is 0.

from gopigo3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.