Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Rotate a vehicle

see here for a working implementation:

Am Do., 19. Mai 2022 um 00:12 Uhr schrieb Thanhnt Nguyen <>:
Thank you Jakob Erdmann
About remoteControl via vehicle.moveToXY, I don't see the method "moveToXY" in TraCICommandInterface::Vehicle. I attempted to write my own one:
void TraCICommandInterface::Vehicle::moveToXY(std::string edgeId,int32_t laneid,double x,double y,double angle){
    uint8_t variableId = MOVE_TO_XY;
    uint8_t variableType = TYPE_COMPOUND;
    int32_t count = 5;
    uint8_t edgeType = TYPE_STRING;
    uint8_t lanidType = TYPE_INTEGER;
    uint8_t postionType = TYPE_DOUBLE;
    uint8_t routeType = TYPE_BYTE;
    uint8_t route = 1;
    TraCIBuffer buf = connection->query(CMD_SET_VEHICLE_VARIABLE, TraCIBuffer() << variableId << nodeId << variableType <<
               count <<edgeType << edgeId << lanidType << laneid << postionType << x << postionType << y <<postionType <<
               angle << routeType << route );
However when the method is called, I get an error: "Answered with error to command 0xc4: Wrong position in requestMessage after dispatching command 196. Expected command length was 60 but 58 Bytes were read."
The "vehicle.moveToXY" is in TraCI python, isn't it? If yes, would I call it from C++ program

Thank you for your time

On Wed, May 18, 2022 at 2:24 PM Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:
Currently, the TraCI API does not provide a method for changing the angle directly.
If you are doing remoteControl via vehicle.moveToXY you can also override the angle but this makes it necessary to handle the position updates as well.

An alternative would be to make the vehicle invisible (set it's RGBA alpha=0)  and draw a POI in it's place. You can set the POI to render as an image file and freely change it's rotation

Am Mi., 18. Mai 2022 um 13:48 Uhr schrieb Thanhnt Nguyen <>:
Dear all
I have a question: How to rotate a vehicle in Omnet++/Veins/Sumo project?
I suppose the TraciCommandInterface lacks setAngle or changeAngle method to rotate the car
I am working in a small project: simulate an AGV (Automated Guided Vehicle) and one of the difference (between car and AGV) is that AGV could rotate itself instead of turning left/right
Thank you in advance
sumo-user mailing list
To unsubscribe from this list, visit
sumo-user mailing list
To unsubscribe from this list, visit

Nguyen Tien Thanh
Department of Software Engineering
School of Information and Communication Technology (SoICT,
Hanoi University of Technology (HUT,
1 DaiCoViet Road, Hanoi, Vietnam
Tel: +84-4-8682595/8683730 Fax +84-4-8692906
Mobile: +84987768886
sumo-user mailing list
To unsubscribe from this list, visit

Back to the top