physics package

Overview

This is the module that is responsible for the movement of the vehicle in the simulation. Each vehicle is initialized with a physics module that determines the characteristics such as engine, fuel consumption, vehicle dynamics etc. Currently a front wheel drive model is implemented under vehicle dynamics, and can be extended later to more complex models that include tire force modeling, longitudinal and lateral forces, etc.

This module takes control signal as the input from the vehicle decision module. The control signal comprises of steering, gas and brake values, which are computed by the ADAS module according to the decision taken. Currently, a simple model is implemented that does not consider all the forces acting on the vehicle, rotation of the tires, etc. Given the control signal, the velocity of the front wheels is modified as v = u + a t, where u is the velocity in the previous time instant, a is the gas or the brake value (negative), and v is the velocity calculated at the current time instant. Using this v, the new new coordinates of the front tires are calculated, and the coordinate of the center of the line joining them is calculated. Using this center and the updated vehicle heading (from the steering signal), the updated location of the center of gravity of the vehicle is calculated, and correspondingly of the entire chasis. The updated coordinates of the vehicle (coordinates of the center of gravity, and the heading of the vehicle) is updated in the simulation so that the display can be updated.

physics.update_car_states module

core.lib.physics.update_car_states.four_wheel_drive(x, y, heading, speed, length, steering_angle, gas, brake, gas_to_acc=1, brake_to_acc=1)

Simulates the physics of all wheel drive model.

Parameters:
  • x (float) – x coordinate of car
  • y (float) – y coordinate of car
  • heading (float) – in radians
  • speed (float) – in meters/sec
  • length (float) – in meters
  • steering_angle (float) – in radians
  • gas (float) – acceleration to give. Normalized in 0 to 1
  • brake (float) – brake to give. Normalized in 0 to 1
  • gas_to_acc (float) – constant specifying the multiplying factor
  • brake_to_acc (float) – constant specifying the multiplying factor
Returns:

(x, y, heading, speed)

Return type:

tuple

Note

Not implemented yet.

core.lib.physics.update_car_states.two_wheel_drive(x, y, heading, speed, length, steering_angle, gas, brake, gas_to_acc=1, brake_to_acc=1)

Simulates the physics of a front two wheel drive model.

Parameters:
  • x (float) – x coordinate of car
  • y (float) – y coordinate of car
  • heading (float) – in radians
  • speed (float) – in meters/sec
  • length (float) – in meters
  • steering_angle (float) – in radians
  • gas (float) – acceleration to give. Normalized in 0 to 1
  • brake (float) – brake to give. Normalized in 0 to 1
  • gas_to_acc (float) – constant specifying the multiplying factor
  • brake_to_acc (float) – constant specifying the multiplying factor
Returns:

(x, y, heading, speed)

Return type:

tuple