Closed gcruiser closed 3 months ago
Hello, thank you for your interest in LimSim and LimSim++. As of now, LimSim supports controlling vehicle motion through Meta-actions (in LimSim++) and trajectory control.
from trafficManager.common.vehicle import Behaviour
# your_behavior: Behaviour = your_model.output()
trajectories = planner.plan(
model.timeStep * 0.1, roadgraph, vehicles, your_behavior, other_plan=False
)
model.setTrajectories(trajectories)
# your_trajectory = your_model.output()
model.setTrajectories(trajectories)
Unfortunately, we do not currently support controlling vehicles through continuous actions (such as acceleration and steering). Achieving this in the current version is challenging. Our next step will be to provide a CARLA ONLY version, which may support this functionality.
Of course, if you can implement this feature, feel free to submit a pull request. 🚗🔧
Alternatively, you can write a function that converts continuous actions into trajectories, allowing you to control vehicles in LimSim. This is a relatively straightforward solution. For example, consider the following simple function to achieve this:
import math
def update_state(x, y, v, acc, yaw, steering, dt):
# Update speed
v_new = v + acc * dt
# Update direction
yaw_new = yaw + steering * dt
# Update position
x_new = x + v_new * math.cos(yaw_new) * dt
y_new = y + v_new * math.sin(yaw_new) * dt
return x_new, y_new, v_new, yaw_new
Of course this is only a rough version of the implementation, you can design more realistic functions according to your own requirements.
Thanks!
Alternatively, you can write a function that converts continuous actions into trajectories, allowing you to control vehicles in LimSim. This is a relatively straightforward solution. For example, consider the following simple function to achieve this:
import math def update_state(x, y, v, acc, yaw, steering, dt): # Update speed v_new = v + acc * dt # Update direction yaw_new = yaw + steering * dt # Update position x_new = x + v_new * math.cos(yaw_new) * dt y_new = y + v_new * math.sin(yaw_new) * dt return x_new, y_new, v_new, yaw_new
Of course this is only a rough version of the implementation, you can design more realistic functions according to your own requirements.
Thanks for the work! May I ask if limsim supports using neural network models trained through deep learning or reinforcement learning as multi vehicle decision models? My trained model takes environment observation as input and output continuous actions [acceleration, steering] in every step for the next step.