Hello,
The value of pred may be a nullpointer in some calling contects among which
is lane-changing (the followspeed function is not only used when
car-following but also when determining appropriate gaps for
lane-changing). Therefore, instead of
std::cout << " pred ID=" << pred->getID();
use
if (pred != 0) {
  std::cout << " pred ID=" << pred->getID();
}


2018-04-06 17:56 GMT+02:00 Umair Durrani <durra...@uwindsor.ca>:

> Thank you. I won't bother you with common C++ programming issues in
> future. But I think I have encountered an error that is related to multiple
> files where pred has been introduced.
>
> As you suggested, I printed the pred->getID() in 
> MSCFModel_Wiedemann::followSpeed()
> function before the return statement:
>
> MSCFModel_Wiedemann::followSpeed(const MSVehicle* const veh, double /*
> speed */, double gap2pred, double predSpeed, double /*predMaxDecel*/, const
> MSVehicle* const pred) const {
>     std::cout << " pred ID=" << pred->getID();
> return _v(veh, predSpeed, gap2pred);
> }
>
> With this change (and build) I ran a simulation where the ego vehicle
> starts from a ramp and enters a highway. Initially there was no pred
> vehicle so nothing was printed. When the ego vehicle approached the
> highway, the pred vehicle on the highway was pred1 until time step 42 (see
> attached image). However, at this time another vehicle (pred2) was passing
> the ego vehicle. This means that in time step 43 (or the end of 42), the
> pred2 becomes the pred vehicle. But the simulation throws an error at the
> end of time step 42.
>
> I suspect this is because of the change in pred->getID(). But in the
> simulation it is expected that pred vehicle could change at any time.
>
> Can you please help me fix this?
>
> best regards,
> *Umair Durrani *
> Ph.D. Candidate
> Civil and Environmental Engineering
> LinkedIn <https://www.linkedin.com/in/durraniu/>
>
> On Fri, Apr 6, 2018 at 1:59 AM, Jakob Erdmann <namdre.s...@googlemail.com>
> wrote:
>
>> The function MSCFModel_Wiedemann::_v does not have access to the lead
>> vehicle.
>> You must either add another parameter to that function and modify the
>> call to _v in MSCFModel_Wiedemann::followSpeed or you just do your
>> printing in
>> MSCFModel_Wiedemann::followSpeed before the call to _v (i.e.
>> pred->getID()).
>> I advise seeking programming guidance on your campus as you will run into
>> lots of questions like these and general programming help is beyond the
>> scope of this mailing list.
>>
>> regards,
>> Jakob
>>
>> 2018-04-06 1:12 GMT+02:00 Umair Durrani <durra...@uwindsor.ca>:
>>
>>> Thanks for your help.
>>>
>>> Coming back to the lead vehicle, how do I use the pred object? To
>>> clarify, I mean that for the veh object I get the information from
>>> MSVehicle.h and MSVehicleType.h files. For example within the _v() function,
>>> I can do:
>>>
>>> std::cout << veh->getID();
>>>
>>> But where do I get the ID and other attributes of pred?  Could you
>>> please give me an example of printing the lead vehicle ID and type/class in
>>> the _v() function?
>>>
>>> I am really thankful for your patience and help.
>>>
>>>
>>>
>>> best regards,
>>> *Umair Durrani *
>>> Ph.D. Candidate
>>> Civil and Environmental Engineering
>>> LinkedIn <https://www.linkedin.com/in/durraniu/>
>>>
>>> On Thu, Apr 5, 2018 at 2:39 PM, Jakob Erdmann <
>>> namdre.s...@googlemail.com> wrote:
>>>
>>>> You need a working installation of python and then the version.h file
>>>> is automatically generated during the build process.
>>>>
>>>>
>>>> 2018-04-05 20:32 GMT+02:00 Umair Durrani <durra...@uwindsor.ca>:
>>>>
>>>>> Thanks. I have downloaded it from github.
>>>>>
>>>>> However, when I build it I get an error:  Cannot open include file:
>>>>> 'version.h': No such file or directory
>>>>>
>>>>> So, I opened an github issue:  Error: Cannot open include file:
>>>>> 'version.h': No such file or directory #3967 on sumo master.
>>>>>
>>>>> best regards,
>>>>> *Umair Durrani *
>>>>> Ph.D. Candidate
>>>>> Civil and Environmental Engineering
>>>>> LinkedIn <https://www.linkedin.com/in/durraniu/>
>>>>>
>>>>> On Thu, Apr 5, 2018 at 2:27 PM, Jakob Erdmann <
>>>>> namdre.s...@googlemail.com> wrote:
>>>>>
>>>>>> the files at http://sumo.dlr.de/wiki/Downlo
>>>>>> ads#SUMO_-_Latest_Development_Version are only updated during the
>>>>>> night. If you download tomorrow you should be able to get them there.
>>>>>> Alternatively, download them directly from github:
>>>>>> https://github.com/DLR-TS/sumo/archive/master.zip
>>>>>>
>>>>>> regards,
>>>>>> Jakob
>>>>>>
>>>>>> 2018-04-05 17:16 GMT+02:00 Umair Durrani <durra...@uwindsor.ca>:
>>>>>>
>>>>>>> Hi Jakob,
>>>>>>>
>>>>>>> Thanks for your reply. I see that you made changes few hours ago.  I'm
>>>>>>> very new to git/github and developement so please bear with me.
>>>>>>>
>>>>>>> Based on the commit ID you provided, I found that the changes are
>>>>>>> shown on this URL: https://github.com/DLR-TS
>>>>>>> /sumo/commit/8f43c4a6874690c0a41443b1efbead0e4384f921
>>>>>>>
>>>>>>> So, I thought when I download the development version from this
>>>>>>> link: (http://sumo.dlr.de/wiki/Downloads#SUMO_-_Latest_Development
>>>>>>> _Version)  I'd get the new files
>>>>>>>
>>>>>>> However, I don't see any changes in the files. Where can I download
>>>>>>> the latest development version that includes those followSpeed() changes
>>>>>>> that you recently made?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> best regards,
>>>>>>> *Umair Durrani *
>>>>>>> Ph.D. Candidate
>>>>>>> Civil and Environmental Engineering
>>>>>>> LinkedIn <https://www.linkedin.com/in/durraniu/>
>>>>>>>
>>>>>>> On Thu, Apr 5, 2018 at 3:31 AM, Jakob Erdmann <
>>>>>>> namdre.s...@googlemail.com> wrote:
>>>>>>>
>>>>>>>> Hello,
>>>>>>>> in the very latest development version
>>>>>>>> (8f43c4a6874690c0a41443b1efbead0e4384f921) the followSpeed() API
>>>>>>>> includes a parameter for the lead vehicle. Note, that in some calling
>>>>>>>> contexts, this value may be a nullpointer
>>>>>>>> regards,
>>>>>>>> Jakob
>>>>>>>>
>>>>>>>> 2018-04-03 20:23 GMT+02:00 Umair Durrani <durra...@uwindsor.ca>:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I am looking into the Wiedemann model and related
>>>>>>>>> ​.​
>>>>>>>>> cpp and .h files in the development version of SUMO.
>>>>>>>>>
>>>>>>>>> Is there a way to print or do something with the LEAD vehicle type
>>>>>>>>> in the MSCFModel_Wiedemann.cpp?. I found 'gap2pred' and 'predspeed' 
>>>>>>>>> but
>>>>>>>>> nothing like 'predType' or 'predClass'.
>>>>>>>>>
>>>>>>>>> Ideally, I want to change the behavior of following vehicle if the
>>>>>>>>> lead vehicle class is a truck.
>>>>>>>>>
>>>>>>>>> best regards,
>>>>>>>>> *Umair Durrani *
>>>>>>>>> Ph.D. Candidate
>>>>>>>>> Civil and Environmental Engineering
>>>>>>>>> LinkedIn <https://www.linkedin.com/in/durraniu/>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> sumo-dev mailing list
>>>>>>>>> sumo-dev@eclipse.org
>>>>>>>>> To change your delivery options, retrieve your password, or
>>>>>>>>> unsubscribe from this list, visit
>>>>>>>>> https://dev.eclipse.org/mailman/listinfo/sumo-dev
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> sumo-dev mailing list
>>>>>>>> sumo-dev@eclipse.org
>>>>>>>> To change your delivery options, retrieve your password, or
>>>>>>>> unsubscribe from this list, visit
>>>>>>>> https://dev.eclipse.org/mailman/listinfo/sumo-dev
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> sumo-dev mailing list
>>>>>>> sumo-dev@eclipse.org
>>>>>>> To change your delivery options, retrieve your password, or
>>>>>>> unsubscribe from this list, visit
>>>>>>> https://dev.eclipse.org/mailman/listinfo/sumo-dev
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> sumo-dev mailing list
>>>>>> sumo-dev@eclipse.org
>>>>>> To change your delivery options, retrieve your password, or
>>>>>> unsubscribe from this list, visit
>>>>>> https://dev.eclipse.org/mailman/listinfo/sumo-dev
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> sumo-dev mailing list
>>>>> sumo-dev@eclipse.org
>>>>> To change your delivery options, retrieve your password, or
>>>>> unsubscribe from this list, visit
>>>>> https://dev.eclipse.org/mailman/listinfo/sumo-dev
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> sumo-dev mailing list
>>>> sumo-dev@eclipse.org
>>>> To change your delivery options, retrieve your password, or unsubscribe
>>>> from this list, visit
>>>> https://dev.eclipse.org/mailman/listinfo/sumo-dev
>>>>
>>>>
>>>
>>> _______________________________________________
>>> sumo-dev mailing list
>>> sumo-dev@eclipse.org
>>> To change your delivery options, retrieve your password, or unsubscribe
>>> from this list, visit
>>> https://dev.eclipse.org/mailman/listinfo/sumo-dev
>>>
>>>
>>
>> _______________________________________________
>> sumo-dev mailing list
>> sumo-dev@eclipse.org
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/sumo-dev
>>
>>
>
> _______________________________________________
> sumo-dev mailing list
> sumo-dev@eclipse.org
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/sumo-dev
>
>
_______________________________________________
sumo-dev mailing list
sumo-dev@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/sumo-dev

Reply via email to