You'll have to patch TraCICommandInterface to add this method. The code is
easily adaptable from other entities that provide a position (i.e. Poi)
On the implementation side, it should look like this:

Coord TraCICommandInterface::Person::getPosition()
{
return traci->genericGetCoord(CMD_GET_PERSON_VARIABLE, personId,
VAR_POSITION, RESPONSE_GET_PERSON_VARIABLE);
}

Adding a pull-request against https://github.com/sommer/veins may help out
future Veins users.

Am Fr., 22. Apr. 2022 um 09:50 Uhr schrieb Thanhnt Nguyen <
thanhnt....@gmail.com>:

> Thank you.
> I suppose "traci" is an attribute of DemoBaseApplLayer class. In this
> class "traci" is an instance of TraCICommandInterface.
> However the TraCICommandInterface class has no attribute named "person"
> How could I access it?
>
>
> On Fri, Apr 22, 2022 at 9:26 AM Jakob Erdmann <namdre.s...@gmail.com>
> wrote:
>
>> The default way to write position information is with --fcd-output.
>> If you need the information at runtime, you can call
>> traci.person.getPosition(personID)
>> The list of all person ids can be obtained with traci.person.getIDList()
>> (This includes all persons generated by a personFlow)
>>
>> Am Fr., 22. Apr. 2022 um 09:20 Uhr schrieb Thanhnt Nguyen <
>> thanhnt....@gmail.com>:
>>
>>> I found a quick hack to get coordinates of all pedestrians in personFlow.
>>> In the source code of SUMO, edit the file: GUIEdge.cpp. More
>>> specifically, find the statement:
>>> person->drawGL(s);
>>> and then write a new line: std::cout<<person->getPosition()<<std::endl;
>>> It works, the position will be printed as sumo-gui runs alone.
>>> However, a new problem arises: My project needs positions to be
>>> available while the simulation is running. But the data of position is not
>>> printed as choosing "Run as Omnet++ simulation". The simulation should end
>>> and a user should close the Qtenv, the data would be available in the
>>> terminal. I tried other ways (such as writing a file) but it doesn't
>>> change: data only is printed after a user closes Qtenv.
>>> _______________________________________________
>>> sumo-user mailing list
>>> sumo-user@eclipse.org
>>> To unsubscribe from this list, visit
>>> https://www.eclipse.org/mailman/listinfo/sumo-user
>>>
>> _______________________________________________
>> sumo-user mailing list
>> sumo-user@eclipse.org
>> To unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/sumo-user
>>
>
>
> --
> Nguyen Tien Thanh
> Department of Software Engineering
> School of Information and Communication Technology (SoICT,
> http://www.fit.hut.edu.vn)
> Hanoi University of Technology (HUT, http://www.hut.edu.vn)
> 1 DaiCoViet Road, Hanoi, Vietnam
> Tel: +84-4-8682595/8683730 Fax +84-4-8692906
> Mobile: +84987768886
> E-mail: than...@soict.hut.edu.vn
>            ntth...@it-hut.edu.vn
>            thanhnt....@gmail.com
> Website: www.fit.hut.edu.vn/~thanhnt
> <http://www.fit.hut.edu.vn/%7Ethanhnt>
> _______________________________________________
> sumo-user mailing list
> sumo-user@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/sumo-user
>
_______________________________________________
sumo-user mailing list
sumo-user@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/sumo-user

Reply via email to