sonyccd / roboclaw_ros

ros for roboclaw
BSD 2-Clause "Simplified" License
50 stars 92 forks source link

fixing check for variable existence #8

Closed kotaweav closed 7 years ago

kotaweav commented 7 years ago

By trying to call enc1 and enc2 with them possibly not being defined it can throw a NameError. In addition, when it is defined, this will always evaluate to true unless the /value/ of enc1 and enc2 are strings that are the names of variables. locals() returns a dictionary, where the keys are the names of the variable as type string and the values are the values of the variables. The search must be performed with a string instead of by type. This also avoids the earlier mentioned error.

stallapragada3 commented 2 years ago

Hello! I am receiving the following exception when I am using your library: SerialException: write failed: [Errno 5] Input/output error

It is usually having to do with the port.write lines such as this one: port.write(chr(val & 0xFF))

Do you know what could be wrong and what I could do to fix this?