-
Notifications
You must be signed in to change notification settings - Fork 36
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
How to trigger SendFrame() api for CAN relevant participants for a cyclic interval #187
Comments
Hello @AmanChaturvedi24, thank you for your question! Im not 100% sure that I understand your issue correctly, if the following isn't what you meant, please clarify. When using SIL Kit with time-synchronization, the participant only sees steps with the duration you specified when registering the simulation step handler. The outgoing messages will be annotated with the timestamp you are informed about in the simulation step handlers If your simulation doesn't care about the timestamps, and also doesn't care that the frames arrive 'together' (from the point of view of another participant), just send the five frames in the desired order during the simulation step handler. If the timestamps are important to you, identify the smallest required time step and use that when registering the simulation step handler. You will get more invocations of the simulation step handler, but also get the required timestamps. You will likely have to adjust the logic such that it can deal with these smaller steps. EDIT (VDanielEdwards): Fixed typo |
HI @VDanielEdwards, even if i change my step size to a lesser value lets say 100ms i still did not get how can trigger the SendFrame_3 after every 10 ms so that in one simulation cycle it will get executed 10 times with specific interval in between (i.e. 10ms virtual time). |
I meant to use the simulation step handler like this: using namespace std::chrono_literals; // for the ...ms literal suffix
// ...
timeSyncService->SetSimulationStepHandler(
[&](std::chrono::nanoseconds now, std::chrono::nanoseconds duration)
{
if (now % 1000ms == 0ms)
{
SendFrame_1(canController_1, logger);
}
if (now % 1000ms == 200ms)
{
SendFrame_2(canController_2, logger);
}
if (now % 1000ms == 400ms)
{
SendFrame_3(canController_3, logger);
}
// ...
},
100ms); |
I have a co-simulation where participnats are communicating over CAN api (OperationMode :: Coordinated)
For example :
my StepSize is 10 ms and i want certain functions to be triggered for every 2 ms per simulation cycle
So in ideal case, such function should be triggered 5 times per simulation cycle
Is this something that could be achieved with the current version ?
The text was updated successfully, but these errors were encountered: