-
Notifications
You must be signed in to change notification settings - Fork 13
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
Update CARLA Ambassador to use XMLRPC Client #165
Conversation
Update CARLA Ambassador to trigger interactions for detections Updated Detector registration to include infrastructure ID
.../mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/carlaconnect/CarlaXmlRpcClient.java
Outdated
Show resolved
Hide resolved
...lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/DetectedObject.java
Show resolved
Hide resolved
.../mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/carlaconnect/CarlaXmlRpcClient.java
Outdated
Show resolved
Hide resolved
.../mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/carlaconnect/CarlaXmlRpcClient.java
Outdated
Show resolved
Hide resolved
@@ -351,15 +357,29 @@ public synchronized void processTimeAdvanceGrant(long time) throws InternalFeder | |||
nextTimeStep += carlaConfig.updateInterval * TIME.MILLI_SECOND; | |||
isSimulationStep = false; | |||
} | |||
// TODO: What is this. Why are we request a time advance based on this counter and | |||
// what is it counting. It is labeled as counting the times we attempt to connect to | |||
// CARLA but it seems to increment every time processTimeAdvanceGrant is called | |||
rti.requestAdvanceTime(nextTimeStep + this.executedTimes, 0, (byte) 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kjrush Do you have any information why were are requesting time advance like this with a continuously incremented counter? If you have any information about executedTimes and why its used in our requestAdvanceTime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a quick skim of the rest of this PR, but so far focused on this.
I don't really see what purpose this executed times has, to be honest. It might just be entirely unnecessary. For the record, it doesn't increment infinitely. It's actually reset later on in the code inside the receiveInteraction(SimulationStepResponse)
method. The interactions being received there seem to be generated whenever SUMO provides a new TraCI update, so it should be frequently, so this should never go above a small value, maybe 10 at most.
But even 10 doesn't make much sense, considering this requestAdvanceTime
arg is in milliseconds, and there's no multiplicative factor applied to this executedTimes
value (unlike carlaConfig.updateInterval
above), so it's small enough it probably doesn't actually do anything. I imagine it was implemented like this with the goal that if we don't have any fresh data from sumo, we should wait longer to delay the CARLA updates until we do have fresh data. But I'm not sure that's needed and it seems unlikely this is actually accomplishing that.
I think you were right to be questioning about this line, but in the end I'm not sure it matters one way or the other. I'd be in favor of just removing it, but keeping this line in our mental bookmarks in case we run into issues with the ambassador. If we hit those issues we'll have this top of mind to re-investigate.
Kudos, SonarCloud Quality Gate passed! 0 Bugs 77.5% Coverage The version of Java (11.0.21) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17. |
PR Details
Description
Add logic to CARLA Ambassador to use XMLRPC Client to dynamically create sensor and retrieve detections. More specifically: the CARLA Ambassador will now create a CARLA XML RPC Client on startup. Its configuration parameters (constructor arguments) will be loaded from the carla_config.json configuration file for the CARLA Ambassador. This is currently limited to carlaCDASimAdapterUrl which tells the XMLRPC client where the XMLRPC server is hosted.
Next the CARLA Ambassador now listens for Detector Registration Interactions which are triggered by the Infrastructure Ambassador in response to infrastructure registration attempts that include sensors. When receiving a Detector Registration Interaction, the CARLA Ambassador will tell the CARLA XML RPC Client to make a
create_sensor
request for each detector registration interaction to create the sensors in CARLA. On each timestep, which should be at 100 ms intervals, the CARLA Ambassador will now also callget_detections
for every successfulcreate_sensor
attempt. This means that all the created sensor in CARLA will have their detections polled at the same interval as the CARLA Ambassador runsprocessTimeAdvanceGrant
. The detections retrieved from the CARLA CDA Sim Adapter via the XMLRPC client will be serialized intoDetectedObject
(s) from json and triggered as interactions for other listening Ambassadors, mainly the infrastructure ambassador.Related Jira Key
CDAR-209
Related Issue
#211
Motivation and Context
Add CARLA Sensor pipeline for creating sensors and getting detections for CARMA-Streets
How Has This Been Tested?
Unit testing
Types of changes
Checklist:
CARMA Contributing Guide