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

Conversation

Roger-random
Copy link

@Roger-random Roger-random commented Sep 6, 2018

SYMPTOM: Unpredictable errors 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

SEE: Issue #13

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant