Welcome to synchronizer’s documentation!

Synchronizer

Overview

Allows a leader process to synchronize with a follower process. The mode (synchronous or asynchronous) can be changed programmatically during runtime.

For exemple, in the follower process:

// running at 200Hz when in async mode
double frequency = 200;

// will have loop running sync or async
synchronizer::Follower synchronizer("synchronizer_id",frequency);

while (running)
{
   // code doing things

   // pulsing instead of sleeping
   synchronizer.pulse();
}

and in the leader process:

synchronizer::Leader leader ("synchronizer_id");

leader.start_sync();
for(int i=0;i<1000;i++)
{
    // code doing thing

    // sleeping to get desired frequency
   usleep(1000);

    // requesting the follower to run one iteration
    leader.pulse()

}

leader.stop_sync();

The expected behavior:

  • when follower is started, it runs at 200Hz

  • when leader is started, leader and follower run at same frequency (~ 1Khz)

  • when leader exit (calls stop_sync), follower returns at 200Hz

Python

Python bindings are generated via Pybind11. Python/c++ follower/leader processes are compatible one with another (e.g. follower in python, leader in cpp)

Demos

For concrete examples (c++ and python), look at the demos folder. Note that the follower must be started before leader.

Limitation

A follower can be linked to only one leader (at a time), and a leader to one follower.

Installation and compilation

This is an ament package. Recommanded method for cloning is to use treep with configuration treep_machines_in_motion and project “CORE_ROBOTICS”

Licence

BSD-3 clause

Author

Vincent Berenz, Max Planck Institute for Intelligent Systems

Indices and Tables

License and Copyrights

BSD 3-Clause License

Copyright (c) 2019, New York University and Max Planck Gesellshaft. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.