Hi Jakob,
I am providing the subscription time in milliseconds. I ended up running
Sumo under the debugger to see what was happening:

It turns out it is registering the subscriptions OK, but I didn't realise
that it was concatenating the messages with the CMD_SIMSTEP2 message. As I
have written my own (small edits to TraCIAPI code) asynchronous receiver in
a separate thread, I was missing that. I was decoding up to the
CMD_SIMSTEP2 part and throwing the rest away.

I am now looking to decode the message correctly and have noticed that it
contains a 'noActive' byte. This appears to be beyond the cmdLength and
doesn't appear to be ever read by TraCIAPI::simulationStep. Is this a
limitation of the C++ API over the Python, or am I missing something?

Is there some example code for reading these subscriptions? or I am happy
to contribute this code as a sample when I get it working.

Cheers,
Erik



-- 
Erik Newton
Model Integration Engineer
rFactor Pro

e: [email protected]
w: http://www.rfpro.com
m: +44 (0) 7967 270693

This e-mail and any files transmitted with it are private and confidential.
If you have received this email in error please notify the sender
immediately and delete this e-mail from your system. The recipient should
check this email and any attachments for the presence of viruses. rFactor
Pro accepts no liability for any damage caused by any virus transmitted by
this email. rFactor Pro is the trading name of Kangaloosh Limited,
registered in England No. 06427019.

On 4 May 2016 at 11:49, Jakob Erdmann <[email protected]> wrote:

> Are you providing the subscription time in milliseconds?
>
> 2016-05-03 22:22 GMT+02:00 Erik Newton <[email protected]>:
>
>> Thanks again Jakob,
>> I'm still having problems. I can now subscribe for each vehicle in the
>> simulation, but then I just get a single message from each vehicle I
>> requested.
>> If I subscribe again later in the same simulation, then again I just get
>> a single message after then next time step.
>> Any ideas what may be wrong? Are there common issues with the time range
>> which make the request invalid, but still return a single status?
>> Cheers,
>> Erik
>>
>>
>> --
>> Erik Newton
>> Model Integration Engineer
>> rFactor Pro
>>
>> e: [email protected]
>> w: http://www.rfpro.com
>> m: +44 (0) 7967 270693
>>
>> This e-mail and any files transmitted with it are private and
>> confidential. If you have received this email in error please notify the
>> sender immediately and delete this e-mail from your system. The recipient
>> should check this email and any attachments for the presence of viruses.
>> rFactor Pro accepts no liability for any damage caused by any virus
>> transmitted by this email. rFactor Pro is the trading name of Kangaloosh
>> Limited, registered in England No. 06427019.
>>
>> On 2 May 2016 at 09:09, Jakob Erdmann <[email protected]> wrote:
>>
>>> Hello,
>>> you need to be aware, that vehicles may not be inserted immediately into
>>> the network if there is insufficient space for them. For these vehicles
>>> moveToXY will do nothing (unless you use the very latest development
>>> version, where this is fixed).
>>> Regarding, subscriptions
>>>
>>> Regarding subscriptions, my former phrasing was unclear: You need to
>>> subscribe once for each single vehicle, and then you receive the variables
>>> for all subscriptions as response to the 'simulation step' command.
>>>
>>> regards,
>>> Jakob
>>>
>>>
>>>
>>> 2016-04-29 17:44 GMT+02:00 Erik Newton <[email protected]>:
>>>
>>>> Thanks Jakob,
>>>> That looks like exactly what I need.
>>>>
>>>> I'm struggling to get it to work though. After a single call to
>>>> send_commandSubscribeObjectVariable I'm just receiving a single response
>>>> rather than many.
>>>> In a class derived from TraCIAPI, I have set up a separate thread which
>>>> loops around a call to receiveExact(inMsg) and decodes all the received
>>>> messages.
>>>>
>>>> and rather than calling simulationStep, I am calling
>>>> send_commandSimulationStep, so that bit doesn't block and wait for a
>>>> response.
>>>>
>>>> I don't know whether my problem is related to the objID parameter of
>>>> send_commandSubscribeObjectVariable. Why does it need that as I would just
>>>> expect send_commandSubscribeObjectContext to need that. or I am
>>>> misunderstanding.
>>>> or it could be to do with beginTime/endTime, but I think I have it
>>>> right (and I do get one message).
>>>>
>>>> Related to this, I thought maybe I had to have my own dynamically added
>>>> vehicle to use as objID, but am having difficulty to add a vehicle and it
>>>> return a valid Position. I can take over a vehicle defined in the scenario
>>>> and move it, but my dynamically added one always returns
>>>> INVALID_DOUBLE_VALUE.
>>>>
>>>> My gash code is roughly as follows. It only starts the receive thread
>>>> near the end:
>>>>
>>>>         mStartTime = simulation.getCurrentTime();
>>>>
>>>>         // Run until we get some vehicles
>>>>         auto IDs = vehicle.getIDList();
>>>>         while (IDs.empty())
>>>>         {
>>>>             simulationStep();
>>>>             IDs = vehicle.getIDList();
>>>>         }
>>>>
>>>>         std::vector<std::string> routes = route.getIDList();
>>>>
>>>>         // This (and variations of it) don't work
>>>>         vehicle.add("Ego", routes[0], "CarA"); //, "DEFAULT_VEHTYPE",
>>>> "-1", "first", "base", 0);
>>>>         vehicle.moveToXY("Ego", "", 0, 15,995.05, 0, false);
>>>>         simulationStep();
>>>>         auto posEgo = vehicle.getPosition("Ego");
>>>>
>>>>         // This does
>>>>         auto pos1 = vehicle.getPosition(IDs[0]);
>>>>         vehicle.moveToXY(IDs[0], "", 0, 998.50,995.05, 0, false);
>>>>         simulationStep();
>>>>         auto pos2 = vehicle.getPosition(IDs[0]);
>>>>
>>>>         hUDPThread = CreateThread(NULL, 0, StartNetworkReceiveThread,
>>>> this, 0, &dwGenericThread);
>>>>
>>>>         std::vector<int> vars;
>>>>         vars.push_back(VAR_POSITION3D);
>>>>         vars.push_back(VAR_ANGLE);
>>>>
>>>> send_commandSubscribeObjectVariable(CMD_SUBSCRIBE_VEHICLE_VARIABLE, "veh0",
>>>> mStartTime, mStartTime+60000, vars);
>>>>
>>>>
>>>> Any help with any of this would be fantastic, thanks.
>>>> Cheers,
>>>> Erik
>>>>
>>>>
>>>> --
>>>> Erik Newton
>>>> Model Integration Engineer
>>>> rFactor Pro
>>>>
>>>> e: [email protected]
>>>> w: http://www.rfpro.com
>>>> m: +44 (0) 7967 270693
>>>>
>>>> This e-mail and any files transmitted with it are private and
>>>> confidential. If you have received this email in error please notify the
>>>> sender immediately and delete this e-mail from your system. The recipient
>>>> should check this email and any attachments for the presence of viruses.
>>>> rFactor Pro accepts no liability for any damage caused by any virus
>>>> transmitted by this email. rFactor Pro is the trading name of Kangaloosh
>>>> Limited, registered in England No. 06427019.
>>>>
>>>> On 27 April 2016 at 07:23, Jakob Erdmann <[email protected]>
>>>> wrote:
>>>>
>>>>> Hello,
>>>>> there is a more efficient mechanism for retrieving data continuously
>>>>> via TraCI, called subscriptions:
>>>>> http://sumo.dlr.de/wiki/TraCI/Object_Variable_Subscription
>>>>> http://sumo.dlr.de/wiki/TraCI/Object_Context_Subscription
>>>>> Basically, you can retrieve all vehicle positions with a single
>>>>> request.
>>>>> However, at 1Khz the simulation itself will become quite slow. I think
>>>>> you are better of running the simulation at 10Hz and interpolating
>>>>> positional data yourself.
>>>>>
>>>>> regards,
>>>>> Jakob
>>>>>
>>>>> 2016-04-26 21:48 GMT+02:00 Erik Newton <[email protected]>:
>>>>>
>>>>>> Hi,
>>>>>> I am currently investigating the possibility of linking SUMO with our
>>>>>> 3D
>>>>>> visualisation software.
>>>>>> Basically I need a high frequency (1KHz) stream of all vehicle
>>>>>> positions
>>>>>> (and maybe a lower frequency stream of vehicle types) I have been
>>>>>> evaluating the TraCI API but am finding it a bit limited for
>>>>>> real-time use.
>>>>>>
>>>>>> E.g. It would appear I have to request each vehicle's position
>>>>>> individually.
>>>>>>
>>>>>> The API is all based on a TCP request and then waiting for a response,
>>>>>> which is killing my real-time application. I have made some progress
>>>>>> with
>>>>>> creating a new class which inherits from TraCIAPI and splitting all
>>>>>> the
>>>>>> receipts into a separate thread, but it seems a bit silly to have to
>>>>>> keep
>>>>>> requesting the same information each time-step.
>>>>>>
>>>>>> Am I missing an obvious way of doing this?
>>>>>>
>>>>>> Could we extend the API to have a mechanism to register an interest in
>>>>>> particular data and it be continually broadcast? Possibly register an
>>>>>> interest in any vehicles within a user-defined radius of the ego
>>>>>> vehicle?
>>>>>>
>>>>>> Alternatively, is there a way to write plugins for SUMO? So I could
>>>>>> just
>>>>>> write my own bespoke output stream of the data I require.
>>>>>>
>>>>>> Thanks in advance for any guidance,
>>>>>>
>>>>>> Erik Newton
>>>>>> Model Integration Engineer
>>>>>> rFactor Pro
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Find and fix application performance issues faster with Applications
>>>>>> Manager
>>>>>> Applications Manager provides deep performance insights into multiple
>>>>>> tiers of
>>>>>> your business applications. It resolves application problems quickly
>>>>>> and
>>>>>> reduces your MTTR. Get your free trial!
>>>>>> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
>>>>>> _______________________________________________
>>>>>> sumo-devel mailing list
>>>>>> [email protected]
>>>>>> https://lists.sourceforge.net/lists/listinfo/sumo-devel
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
sumo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sumo-devel

Reply via email to