Obtain sensor data after actuation in asynchronous mode

Typically: "How do I... ", "How can I... " questions
Post Reply
xli4217
Posts: 11
Joined: 13 Oct 2015, 21:08

Obtain sensor data after actuation in asynchronous mode

Post by xli4217 »

Hi,

I'm controlling a robot in asynchronous mode sending control commands in non-blocking fashion (opmode_onshot or opmode_streaming). At every timestep "t", I issue a control "a_t", how do I make sure that the sensor reading I obtain is the result of issuing "a_t" and not something that's buffered before time "t".

Thank you

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: Obtain sensor data after actuation in asynchronous mode

Post by coppelia »

Hello,

if you need to make sure of that, then you need to run in synchronous mode. You'll maybe also have to set-up a signal that triggers when the sensing section has ended, so that your remote API client knows that the current simulation pass is done and the next can be triggered.

Cheers

xli4217
Posts: 11
Joined: 13 Oct 2015, 21:08

Re: Obtain sensor data after actuation in asynchronous mode

Post by xli4217 »

Thanks for your response. I'm simulating what it's like running on the real robot and the actual robot runs sensing and actuating threads concurrently. Do you think it's sensible to timestamp every signal. For example, if control is running at 10hz and the first control a1 is sent out at time t = 0, then look for the sensor data near t = 0.1 (preferrably less than 0.1) as the result of running a1.

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: Obtain sensor data after actuation in asynchronous mode

Post by coppelia »

If you are running in open loop, simply feeding values to the simulation, then it gets simper: then you can as you say send values together with a time stamp (or send the whole data set at once). Then you can in each simulation step pick the value to corresponds to current time.

Cheers

Post Reply