Describe a time you implemented a state machine for driving behavior in a robotics system.
Implement a deterministic version that processes an event sequence and returns the state after each event. Start in IDLE and use the specified transitions; unrecognized events leave the state unchanged.
Input/output contract: events is a list of strings, and the function returns a list beginning with the initial state and containing one state per event.
start, obstacle, clear, stop, emergency, and resetdef driving_states(events):