Calculate direction of a vehicle (Veins/Omnet++/Sumo)

可紊 提交于 2019-12-22 00:04:22

问题


Is it possible to calculate(get) direction of vehicle in Veins(via TraCIMobility)? I want to know if two vehicles are traveling in opposing directions or not. I think I can do that via getAngleRad() method (if they are moving in the same direction they fall in the same quadrant and if moving opposite they are in opposite quadrants), but I am not sure if its correct. (Sub-Question: Also, what are the exact values that getAngleRad() would return for each quadrant?)


回答1:


You are correct: getAngleRad() returns the vehicle's heading in radians (from -pi up to, but excluding, +pi). A value of 0 means the vehicle is heading east; a value of pi/2 means it is heading north; etc.



来源:https://stackoverflow.com/questions/37975250/calculate-direction-of-a-vehicle-veins-omnet-sumo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!