[ NUIT-93] Fix synch issues between TFs and gazebo/ROS

Merged
#90 · Created  · Last updated

Merged pull request

[ NUIT-93] Fix synch issues between TFs and gazebo/ROS

5903139·Author: ·Closed by: ·2020-11-12

Description

The set of PR related to NUIT-93 fixes synchronization issues between Gazebo/ROS and TFs in the CLE. See NUIT-93 for a description.

How to Test:

Download the related PRs: (user-script, ExDbackend, GazeboRosPackages):

  • $HBP/user-scripts/nrp_update build

  • cle-start

  • start an experiment

  • Add the following TF:

@nrp.MapRobotSubscriber("clock", "/clock") @nrp.Neuron2Robot() def log_times (t, clock): import rospy clock = clock.value.clock gazebo_clock_f = float(clock.secs+(clock.nsecs)*1e-9) ros_get_time = rospy.get_time() time_str = "CLE {:{width}.{prec}f} -- ROS {:{width}.{prec}f} -- gazebo {:{width}.{prec}f}".format(t, ros_get_time, gazebo_clock_f, width=5, prec=3) clientLogger.info(time_str)
  • Open the client logger

  • start the simulation

  • stop the simulator

NOTE that the CLE, ROS and Gazebo are in sync.

 

  • [NUIT-93] Fix synch issues between TFs and gazebo/ROS

    • DeterministicClosedLoopEngine:

      • Pass to TFs, as t parameter, t+timestep. In fact, when TFs are run at end of the of a loop, simulators have already completed their timestep.

    • Rename timestep to timestep_s to highlight the unit of measurement (seconds)

      • Minor renaming and typo fixing

    • DeterministicClosedLoopEngineProfiler:

      • Fix typo

    • RosCommunicationAdapter:

      • Get the time from rospy.get_time() since it works properly now (it's in sync with /clock).

  • [NUIT-93] Fix ClosedLoopEngine.

    ClosedLoopEngine works again: - Do not spawn a new thread at every start() - NOTE: time in TFs starts from 0; as brain, world and TFs runs concurrently. The synch is guaranteed within ONE CLE timestep of accuracy: depending on the relative running times of the 3 component, their internal clock can differ at most of one timestep. This behaviour is different in DeterministicClosedLoopEngine; in fact the latter runs TFs AFTER the two simulators.

  • [NUIT-93] Add synchronization details to CLE docstrings

 

0 attachments

0 comments

Loading commits...