AI Testing Simulator
Loading...
Searching...
No Matches
SnapController Class Reference

SnapController class handles loading and updating of road and waypoint data for the map. More...

Inheritance diagram for SnapController:

Public Member Functions

void Update ()
 Highlights the waypoint indicator nearest to the mouse position.
 
int GetRoadIdAndLaneIdFromString (string laneIdString)
 
Location FindWaypoint (Vector2 mousePosition)
 Finds the nearest waypoint to a given mouse position.
 
AStarWaypoint FindLaneAndWaypoint (Vector2 mousePosition)
 
Lane GetNeighboringLanes (Lane l)
 
bool CheckLaneChange (Lane startLane, Lane endLane, AStarWaypoint startWaypoint, AStarWaypoint endWaypoint)
 Checks if a lane change is possible between the start and end lanes and waypoints.
 
List< intFindPath (Vector2 start, Vector2 end, bool ignoreWaypoints)
 

Static Public Member Functions

static double FastEuclideanDistance (Vector2 a, Vector2 b)
 Computes the fast Euclidean distance between two Vector2 points.
 
static float float y UnityToCarla (float x, float y)
 
static float UnityRotToRadians (float rotation)
 Converts a Unity rotation value to radians.
 
static int CalculateTargetLaneValueCarla (Lane startLane, Lane endLane)
 Calculates the target lane value for Carla, given start and end lanes. (NOT IMPLEMENTD)
 

Public Attributes

GameObject circlePrefab
 
Dictionary< int, Roadroads
 
 int
 Parses a lane ID string and returns the corresponding road ID and lane ID as a tuple.
 
 Lane
 Finds the closest Lane and AStarWaypoint to the given mouse position.
 
 List< Vector2 >
 Finds a path between the start and end positions, considering lane changes and optional waypoint ignoring.
 

Static Public Attributes

static float x
 Converts Unity coordinates to Carla coordinates.
 

Properties

bool IgnoreClicks [get, set]
 

Detailed Description

SnapController class handles loading and updating of road and waypoint data for the map.

Member Function Documentation

◆ CalculateTargetLaneValueCarla()

static int SnapController.CalculateTargetLaneValueCarla ( Lane  startLane,
Lane  endLane 
)
inlinestatic

Calculates the target lane value for Carla, given start and end lanes. (NOT IMPLEMENTD)

Parameters
startLaneThe starting Lane object.
endLaneThe ending Lane object.
Returns
An integer representing the target lane value for Carla.

◆ CheckLaneChange()

bool SnapController.CheckLaneChange ( Lane  startLane,
Lane  endLane,
AStarWaypoint  startWaypoint,
AStarWaypoint  endWaypoint 
)
inline

Checks if a lane change is possible between the start and end lanes and waypoints.

Parameters
startLaneThe starting Lane.
endLaneThe ending Lane.
startWaypointThe starting AStarWaypoint.
endWaypointThe ending AStarWaypoint.
Returns
True if a lane change is possible, false otherwise.</returns

◆ FastEuclideanDistance()

static double SnapController.FastEuclideanDistance ( Vector2  a,
Vector2  b 
)
inlinestatic

Computes the fast Euclidean distance between two Vector2 points.

Parameters
aA Vector2 representing the first point.
bA Vector2 representing the second point.
Returns
A double representing the fast Euclidean distance between the two points.

◆ FindWaypoint()

Location SnapController.FindWaypoint ( Vector2  mousePosition)
inline

Finds the nearest waypoint to a given mouse position.

Parameters
mousePositionThe Vector2 representing the mouse position.
Returns
Returns a Location object of the nearest waypoint.

◆ UnityRotToRadians()

static float SnapController.UnityRotToRadians ( float  rotation)
inlinestatic

Converts a Unity rotation value to radians.

Parameters
rotationA float representing the rotation value in Unity.
Returns
A float representing the rotation value in radians.

Member Data Documentation

◆ int

SnapController.int

Parses a lane ID string and returns the corresponding road ID and lane ID as a tuple.

Parameters
laneIdStringThe lane ID string to parse.
Returns
Returns a tuple containing the road ID and lane ID.

◆ Lane

SnapController.Lane

Finds the closest Lane and AStarWaypoint to the given mouse position.

Returns the neighboring lanes of a given Lane.

Parameters
mousePositionA Vector2 representing the position of the mouse cursor.
Returns

A tuple containing the closest Lane and AStarWaypoint to the given mouse position.</returns

Parameters
lA Lane object.
Returns
A tuple containing the previous and next lanes of the given Lane.

◆ List< Vector2 >

SnapController.List< Vector2 >

Finds a path between the start and end positions, considering lane changes and optional waypoint ignoring.

Parameters
startA Vector2 representing the starting position.
endA Vector2 representing the ending position.
ignoreWaypointsA boolean indicating whether to ignore waypoints and return a direct path.
Returns
A tuple containing a list of Vector2 waypoints and a list of integer indices representing lane changes in the path.

◆ x

float SnapController.x
static

Converts Unity coordinates to Carla coordinates.

Parameters
xA float representing the X coordinate in Unity.
yA float representing the Y coordinate in Unity.
Returns
A tuple containing the X and Y coordinates in Carla.

The documentation for this class was generated from the following file: