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

Fix to avoid TypeError with encoder count value of 'None' #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Sep 6, 2018

  1. Fix to avoid TypeError with encoder count value of 'None'

    SYMPTOM: Unpredictable erros occurring at runtime
        File "roboclaw_node.py", line 232, in run
            rospy.logdebug(" Encoders %d %d" % (enc1, enc2))
        TypeError: %d format: a number is required, not NoneType
    
    CAUSE: Error when calling roboclaw.ReadEnc would result in encoder
    values 'enc1' or 'enc2' to be None instead of a number. This triggers
    TypeError as described above.
    
    FIX: Do exactly what TypeError wants us to do: make sure both 'enc1' and
    'enc2' are numbers before trying to format them as numbers for logging.
    (Note this does not address root cause of ReadEnc failure, that will be
    submitted as a separate fix.)
    
    REFERENCE: Python number check courtesy of StackOverflow: https://stackoverflow.com/questions/3441358/what-is-the-most-pythonic-way-to-check-if-an-object-is-a-number
    Roger-random committed Sep 6, 2018
    Configuration menu
    Copy the full SHA
    a79c2f3 View commit details
    Browse the repository at this point in the history