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 serial sync errors caused by multi thread collision #17

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

Commits on Sep 6, 2018

  1. Fix serial sync errors caused by multi thread collision

    SYMPTOM: Unpredictable errors when calling roboclaw API, manifesting
    in several different forms such as "OSError: 11"
    
    CAUSE: The roboclaw API is not thread-safe, but we have three different
    threads potentially calling into the API simultaneously. When this
    occurs, errors follow.
    1. self.run for our '/odom' publisher thread
    2. self.cmd_vel_callback as  '/cmd_vel' subscriber
    3. self.check_vitals running for diagnostics
    
    FIX: Use a threading.Lock() object to synchronize usage of roboclaw
    API object. Thereby ensuring only one thread will be communicating
    with roboclaw at any given time.
    
    REFERENCES:
    
    ROS Python API Threading Model
    https://answers.ros.org/question/9543/rospy-threading-model/
    
    StackOverflow "Semaphores on Python"
    https://stackoverflow.com/questions/31508574/semaphores-on-python
    Roger-random committed Sep 6, 2018
    Configuration menu
    Copy the full SHA
    163e369 View commit details
    Browse the repository at this point in the history