How can i make the collisions in SUMO without the collider vehicle passing through the colliding vehicle - sumo

I need help regarding the following,
How can i make the collisions in SUMO without the collider vehicle (i.e., the following vehicle) passing through the colliding vehicle (i.e, the vehicle in front)
Right now when the vehicles collide in SUMO, it give the collision warnings (when warning is set as a collision consequence) but at the same time the following vehicle passes through the vehicle in front after collision.
I would rather like to avoid that passing trough of the vehicle after collision is happened. i wish the vehicle stop after the collision in case if the vehicle in front is at full stop.
Is that possible to simulate in SUMO?
Thanks for your cooperation in advance,
Best regards,
/Mateen

As mentioned here you can use the option --collision-stoptime <TIME> to let the vehicles stop.

Related

How to access the SUMO vehicles from highway_overtake.py in Webots?

I'm modifying the highway_overtake.py controller to be able to track the position and speed of the neighboring SUMO vehicles (the ones that are highlighted in transparent colored boxes). How can I access the SUMO vehicle information that is in close proximity of the Lincoln car? I want to get the position, acceleration, speed etc. of the SUMO cars highlighted near the Lincoln car. Here is what I have tried so far:
I have changed the 'supervisor' field to TRUE in the highway overtake world for the lincoln MKZ vehicle node.
I imported the Supervisor from controller in my higway_overtake.py controller file.
I tried calling the traci functions getIDList() and getPosition() but it gives an error that says controller doesn't have any such attributes.
I believe this information can be retrieved from the SumoSupervisor.py file which is the controller file for Sumo Interface. But I do not know how to access this file in my highway_overtake.py script either.
Any information that can help me solve this will be very helpful!
Thanks in advance.
If it's for debugging, you could use this supervisor function to get the positon of all cars in the simulation, and then figure out which one is closed to your target car (which ID you know).
https://cyberbotics.com/doc/guide/supervisor-programming#tracking-the-position-of-robots
Otherwise, if you want to use only functions that are available to actual machines, try the emitter/receiver devices. You might be able to use signal strength as a proxi for proximity, or, if there's a synced tick, use signal reception time as a proximity detector.
Or use GPS modules (with an high enough resolution) on each car and compare the coordinates.

Lane Changing in SUMO

Is it possible to make a vehicle inside SUMO environment which is inserted on a specific lane to shift to other lane in a certain time period from one lane to the other?
Can this be done without using TraCI and is there any particular syntax format to do so?
No, without TraCI this is currently not possible. You could specify a stop on the target lane but this wouldn't be time triggered change but rather location triggered and furthermore the vehicle would stop there (or at least decelerate) and this probably not what you want.

Hybrid Vehicle Simulation with State of Charge Information

My fellow researchers and I have been using SUMO for a bit of time now, and have been helped greatly by the informative posts here in the past - so I just wanted to share some appreciation ahead of time :)
My question is: Is it possible to append a Hybrid Vehicle model in the PHEM program files seen below?:
https://github.com/planetsumo/sumo/tree/master/sumo/src/utils/emissions
Ideally, this hybrid vehicle would be able to include the State of Charge (SOC) control and include the temporal changes of SOC as the vehicle travels according to the drive cycle, just as there are temporal changes to Fuel Consumption, emissions, etc. If possible, we would hope to create a new column for SOC information in the emissionsDrivingCycle output cited here: http://sumo.dlr.de/wiki/Tools/Emissions#emissionsDrivingCycle
Our team was thinking that it would be great to use the emissionsDrivingCycle tool with this new vehicle type, as we could use the standard vehicle definitions in PHEMLight, and define traffic in the standard ways. Essentially we are wondering: 1) Is it feasible to implement a Hybrid Vehicle energy balance model in the PHEM files, and 2) Could these files then be compiled to form a new version of the existing emissionsDrivingCycle tool?
Before we started to play around too much, we thought it would be best to ask the group first to see what the community might have to say.
Thank you all once again!
Regards,
Van
First of all, there are several PHEMlight emission types available but there is currently no hybrid. The problem with hybrids is, that you need essentially to change the emission model while the vehicle is running from combustion to electric (and vice versa) and there may be very different strategies in place for doing so. I would propose to make this change rather explicit than hiding it in an additional emission model file which can do nothing but average over all the different strategies out there. So you can switch emission models in a running simulation simply by giving a new vehicle type to an existing vehicle using TraCI. In Python this would be
traci.vehicle.setType.

SKAction forces nodes through each other after collision

This issue has been discussed here somewhat, but I would like to hear other people experience with physics world forcing nodes to pass through each other unpredictably.
I am using a SKAction to move one node. This node needs to slide at constant speed through the scene until it reaches a certain position. A 2nd node is falling through gravity until it touches the scene frame.
When the two nodes collide, I would assume the falling node is lifted against the gravity. Instead, occasionally, the 2nd node is repositioned on the opposite side of the first node. The collision is properly detected in the didBeginContact.
This seems to depend on the speed of the SKAction. If I slow down the SKAction that makes the 1st node slide by as little as 20%, the collision lift the 2nd node as expected.
What is the best way to work around this kind of behaviors?
Everything is pretty much explained in that link. If you are interested in physics simulation the only sanctioned way is to move all bodies through physics by applying forces or impulses, or by directly changing velocity vector.
If you look how each frame is processed in SpriteKit, you will se that :
actions are executed first
physics is simulated after
So, if you move a node manually, you are not letting the physics simulation to move it where it thinks it should be appropriate. You are pulling the object out of sync with an actual physics simulation. Also, this way, the node will be moved by both - the action and the physics engine, thus the unexpected result.
Contact detection will work though. But don't confuse terms "contact" and "collision" . Contacts will be trigered properly even if you use SKActions to move bodies. But, collisions may not be properly simulated etc . So as long as you are interested in contacts, you are good to go. If interested in any kind of physics similation, then use appropriate ways to interact with physics world.

Collision detection with ODE and other physics engines

My boss gave me this source code and let me add rigid body physics simulate support. Basically this source code simulates a large scene with a lot of buildings and traffic in it. I've checked the collision part of the code, it simply uses a bounding box to check for collisions, so here are my questions:
the scene is large, which is more than 500 buildings,if I want to add rigid body physics,do I have to add each bounding box to ode static object? so new object such as a box so it can interact with buildings?
add 500 bounding box to ode,what about the speed? or should I use some tricks to do it?
What if I want to keep old collision stuff such as the car do a ray test to building and keep that result? If I can, this building is also added to ode, would it be unnecessary?because the collision box is already in ode,or should I use ode ray test instead of internal ray check? I mean the question basically is what is the efficient way to work with both of collision stuff?
Yes, you need to add the bounding box (or mesh) of each of the buildings to ODE. Typically, you will use a QuadTree space, or a Hash space, that contains all of the buildings. The buildings do not need a body, unless you want them to actually move.
You're saying "old collision stuff" -- is there already some collision code in the existing source?
ODE can do ray tests. If you want to use the same methods for all tests, you could change the code to use ODE ray tests, assuming that's what your question is about.
ODE doesn't need to generate the collisions at all. if you already have good collision detection, and just want the rigid body simulation, then generate the right dJointContact joints for each frame to represent the interaction beteween a car and its environment, and simulate (step) only the body/bodies of the car/s, based on those contacts.