Hi Erik,
the ease of getting code accepted hinges on a number of variables. In your
case
- you contributed to a well-isolated part of the code base which makes it
easy to rule out unwanted side effects
- it was easy to add a test for your contribution
- the patch was small enough for me to take the liberty of assuming that
you provide it in the spirit of a public domain contribution. For larger
contributions I would ask you to sign a "Contributor License Agreement"
which ensures that we can continue to use the code in the future. (I'll
send you the legalese if it is of interest to you)

For larger contributions we have given people their own code branch rather
than putting stuff directly into trunk but for smaller stuff patches are
just fine (If you send the patch files directly to the maintainers (i.e.
me) they won't bounce.

regards,
Jakob

2016-05-10 13:10 GMT+02:00 Erik Newton <[email protected]>:

> Cool. I didn't expect it to be that straight forward to get code accepted.
> I have been working this morning on the Context Subscriptions. I'm almost
> at a working version; just tidying up repeated code.
> Is this the best way to submit stuff?
>
> --
> 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 10 May 2016 at 11:46, Jakob Erdmann <[email protected]> wrote:
>
>> Hi Erik,
>> Thanks for the patch. The code is integrated in revisions 20686. We are
>> not yet C++11 enabled so the 'auto' declarations had to go. Otherwise I had
>> no issues with the code. (It passes my tests).
>>
>> cheers,
>> Jakob
>>
>> 2016-05-10 10:02 GMT+02:00 Erik Newton <[email protected]>:
>>
>>> For the purposes of the historic record and because the message group
>>> doesn't accept attachments, here is the patch file copied in:
>>>
>>> Index: utils/traci/TraCIAPI.cpp
>>> ===================================================================
>>> --- utils/traci/TraCIAPI.cpp    (revision 20661)
>>> +++ utils/traci/TraCIAPI.cpp    (working copy)
>>> @@ -428,12 +428,69 @@
>>>      return c;
>>>  }
>>>
>>> +void TraCIAPI::readSubscription(tcpip::Storage &inMsg)
>>> +{
>>> +    auto objectID = inMsg.readString();
>>> +    int variableCount = inMsg.readUnsignedByte();
>>>
>>> +    while (variableCount > 0) {
>>> +
>>> +        auto variableID = inMsg.readUnsignedByte();
>>> +        auto status = inMsg.readUnsignedByte();
>>> +        auto type = inMsg.readUnsignedByte();
>>> +
>>> +        if (status == RTYPE_OK) {
>>> +
>>> +            TraCIValue v;
>>> +
>>> +            switch (type) {
>>> +            case TYPE_DOUBLE:
>>> +                v.scalar = inMsg.readDouble();
>>> +                break;
>>> +            case TYPE_STRING:
>>> +                v.string = inMsg.readString();
>>> +                break;
>>> +            case POSITION_3D:
>>> +                v.position.x = inMsg.readDouble();
>>> +                v.position.y = inMsg.readDouble();
>>> +                v.position.z = inMsg.readDouble();
>>> +                break;
>>> +            case TYPE_COLOR:
>>> +                v.color.r = inMsg.readUnsignedByte();
>>> +                v.color.g = inMsg.readUnsignedByte();
>>> +                v.color.b = inMsg.readUnsignedByte();
>>> +                v.color.a = inMsg.readUnsignedByte();
>>> +                break;
>>> +
>>> +            // TODO Other data types
>>> +
>>> +            default:
>>> +                throw tcpip::SocketException("Unimplemented
>>> subscription type: " + toString(type));
>>> +            }
>>> +
>>> +            subscribedValues[objectID][variableID] = v;
>>> +        }
>>> +        else {
>>> +            throw tcpip::SocketException("Subscription response error:
>>> variableID=" + toString(variableID) + " status=" + toString(status));
>>> +        }
>>> +
>>> +        variableCount--;
>>> +    }
>>> +}
>>> +
>>>  void
>>>  TraCIAPI::simulationStep(SUMOTime time) {
>>>      send_commandSimulationStep(time);
>>>      tcpip::Storage inMsg;
>>>      check_resultState(inMsg, CMD_SIMSTEP2);
>>> +
>>> +    subscribedValues.clear();
>>> +    int numSubs = inMsg.readInt();
>>> +    while (numSubs > 0) {
>>> +        check_commandGetResult(inMsg, 0,-1,true);
>>> +        readSubscription(inMsg);
>>> +        numSubs--;
>>> +    }
>>>  }
>>>
>>>
>>> @@ -1262,8 +1319,31 @@
>>>      return myParent.getInt(CMD_GET_SIM_VARIABLE,
>>> VAR_MIN_EXPECTED_VEHICLES, "");
>>>  }
>>>
>>> +void
>>> +TraCIAPI::SimulationScope::subscribe(int domID, const std::string&
>>> objID, SUMOTime beginTime, SUMOTime endTime, const std::vector<int>& vars) {
>>> +    myParent.send_commandSubscribeObjectVariable(domID, objID,
>>> beginTime, endTime, vars);
>>> +    tcpip::Storage inMsg;
>>> +    myParent.check_resultState(inMsg, domID);
>>> +    myParent.check_commandGetResult(inMsg, domID);
>>> +    myParent.readSubscription(inMsg);
>>> +}
>>>
>>> +std::map<std::string, std::map<int, TraCIAPI::TraCIValue>>
>>> +TraCIAPI::SimulationScope::getSubscriptionResults() {
>>> +    return myParent.subscribedValues;
>>> +}
>>>
>>> +std::map<int, TraCIAPI::TraCIValue>
>>> +TraCIAPI::SimulationScope::getSubscriptionResults(const std::string&
>>> objID) {
>>> +    if (myParent.subscribedValues.find(objID) !=
>>> myParent.subscribedValues.end()) {
>>> +        return myParent.subscribedValues[objID];
>>> +    }
>>> +    else {
>>> +        throw; // Something?
>>> +    }
>>> +}
>>> +
>>> +
>>>  //
>>> ---------------------------------------------------------------------------
>>>  // TraCIAPI::TrafficLightScope-methods
>>>  //
>>> ---------------------------------------------------------------------------
>>> Index: utils/traci/TraCIAPI.h
>>> ===================================================================
>>> --- utils/traci/TraCIAPI.h    (revision 20661)
>>> +++ utils/traci/TraCIAPI.h    (working copy)
>>> @@ -90,8 +90,15 @@
>>>          double xMax, yMax, zMax;
>>>      };
>>>
>>> +    struct TraCIValue {
>>> +        union {
>>> +            double scalar;
>>> +            TraCIPosition position;
>>> +            TraCIColor color;
>>> +        };
>>> +        std::string string;
>>> +    };
>>>
>>> -
>>>      class TraCIPhase {
>>>      public:
>>>          TraCIPhase(const SUMOTime _duration, const SUMOTime _duration1,
>>> const SUMOTime _duration2, const std::string& _phase)
>>> @@ -570,6 +577,10 @@
>>>          TraCIBoundary getNetBoundary() const;
>>>          unsigned int getMinExpectedNumber() const;
>>>
>>> +        void subscribe(int domID, const std::string& objID, SUMOTime
>>> beginTime, SUMOTime endTime, const std::vector<int>& vars);
>>> +        std::map<std::string, std::map<int, TraCIValue>>
>>> getSubscriptionResults();
>>> +        std::map<int, TraCIValue> getSubscriptionResults(const
>>> std::string& objID);
>>> +
>>>      private:
>>>          /// @brief invalidated copy constructor
>>>          SimulationScope(const SimulationScope& src);
>>> @@ -870,6 +881,8 @@
>>>      void processGET(tcpip::Storage& inMsg, int command, int
>>> expectedType, bool ignoreCommandId = false) const;
>>>      /// @}
>>>
>>> +    void readSubscription(tcpip::Storage &inMsg);
>>> +
>>>      template <class T>
>>>      static inline std::string toString(const T& t, std::streamsize
>>> accuracy = OUTPUT_ACCURACY) {
>>>          std::ostringstream oss;
>>> @@ -883,7 +896,7 @@
>>>      /// @brief The socket
>>>      tcpip::Socket* mySocket;
>>>
>>> -
>>> +    std::map<std::string, std::map<int, TraCIValue>> subscribedValues;
>>>  };
>>>
>>>
>>>
>>>
>>> --
>>> 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 9 May 2016 at 20:04, Erik Newton <[email protected]> wrote:
>>>
>>>> How about something along these lines. (Please see attached) I have
>>>> tried to follow the Python API as far as possible, but not sure about
>>>> domains yet and whether they need to be separate etc.
>>>>
>>>> I have made a new type TraCIValue which is a union of all possible
>>>> value types. (There are probably more types to add to it)
>>>>
>>>> It builds up a nested map like so:
>>>> map<objID, map<varNum, TraCIValue>> subscribedValues;
>>>>
>>>> I have developed this on Windows Visual Studio and not tested other
>>>> platforms.
>>>> I have not considered send_commandSubscribeObjectContext yet, but will
>>>> need to for the work I'm doing. I am happy to continue developing if you
>>>> think this is the right direction to go in.
>>>>
>>>> Happy for any feedback; variable scopes, code style etc.
>>>>
>>>> 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 9 May 2016 at 14:30, Jakob Erdmann <[email protected]>
>>>> wrote:
>>>>
>>>>> please do so.
>>>>>
>>>>> 2016-05-09 15:21 GMT+02:00 Erik Newton <[email protected]>:
>>>>>
>>>>>> Sorry noActive is the variable used on line 532 of TraCIServer.cpp.
>>>>>> It is the number of active subscriptions (which will be included in the
>>>>>> message). (I'm using latest SVN trunk)
>>>>>> The Python equivalent to decode this is:
>>>>>> numSubs = result.readInt()
>>>>>> on line 260 of connection.py
>>>>>>
>>>>>> There doesn't appear to be an equivalent to this or
>>>>>> getSubscriptionResults in C++. Should I look towards making one?
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 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 9 May 2016 at 13:10, Jakob Erdmann <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>> there is no example code for reading subscriptions with the C++
>>>>>>> TracCIAPI.
>>>>>>> All tests are in src/traci_testclient/TraCITestClient.cpp::testAPI()
>>>>>>> To be honest this library did not receive much attention and was
>>>>>>> practically unusable before 0.25.0.
>>>>>>> If you have working extensions (i.e. subscription reading) please
>>>>>>> share.
>>>>>>>
>>>>>>> Regarding the 'noActive' byte. I have no Idea what this could be. Is
>>>>>>> this byte constant?
>>>>>>>
>>>>>>> regards,
>>>>>>> Jakob
>>>>>>>
>>>>>>> 2016-05-09 13:47 GMT+02:00 Erik Newton <[email protected]>:
>>>>>>>
>>>>>>>> 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
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
sumo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sumo-devel

Reply via email to