Common (C++)#

class Session#

Public Functions

inline explicit Session(net::io_context &ioc, ssl::context &ctx)#
void set_api_key(const std::string &api_key)#

Set your own api key here.

void set_url(const char *&host, const char *&port, const char *&subdomain)#

Set a specific API URL here.

void connect()#

Connect the session to the host. You can connect once and use the shared session for different request.

void shutdown()#

Shutdown the session.

const std::string request(const std::string &mode, const std::string &body_str, const std::string &url_params, double max_retries = std::numeric_limits<double>::infinity(), const std::vector<int> &status_force_list = {408, 429, 500, 502, 503, 504}, double base_backoff = 1, double backoff_factor = 2, double max_backoff = 0, double jitter_factor = 0.5)#

Use the mode(“location_info”, “initialize”, “drive”) to construct a request, sent the request to host, and return the body string of the response.

Public Members

const char *host_ = local_mode ? "localhost" : "api.inverted.ai"#
const char *port_ = local_mode ? "8000" : "443"#
const char *subdomain = local_mode ? "/" : "/v0/aws/m1/"#
const int version_ = 11#

struct AgentState#

The current or predicted state of a given agent at a given point.

Public Members

double x#

The center point of the agent’s bounding box.

double y#
double orientation#

The direction the agent is facing, in radians with 0 pointing along x and pi/2 pointing along y.

double speed#

In meters per second, negative if the agent is reversing.

struct AgentAttributes#

Static attributes of the agent, which don’t change over the course of a simulation. We assume every agent is a rectangle obeying a kinematic bicycle model.

Public Functions

inline void printFields() const#
inline json toJson() const#
inline AgentAttributes(const json &element)#

Public Members

std::optional<double> length#

Longitudinal, lateral extent of the agent in meters.

std::optional<double> width#
std::optional<double> rear_axis_offset#

Distance from the agent’s center to its rear axis in meters. Determines motion constraints.

std::optional<std::string> agent_type#

Agent types are used to indicate how that agent might behave in a scenario. Currently “car” and “pedestrian” are supported.

std::optional<Point2d> waypoint#

Target waypoint of the agent. If provided the agent will attempt to reach it.

struct TrafficLightState#

Dynamic state of a traffic light.

Public Members

std::string id#
std::string value#
struct InfractionIndicator#

Infractions committed by a given agent, as returned from invertedai::drive().

Public Members

bool collisions#

True if the agent’s bounding box overlaps with another agent’s bounding box.

bool offroad#

True if the agent is outside the designated driveable area specified by the map.

bool wrong_way#

True if the cross product of the agent’s and its lanelet’s directions is negative.

struct StaticMapActor#

Specifies a traffic light placement. We represent traffic lights as rectangular bounding boxes of the associated stop lines, with orientation matching the direction of traffic going through it.

Public Members

int actor_id#

ID as used in invertedai::initialize() and invertedai::drive().

std::string agent_type#

Not currently used, there may be more traffic signals in the future.

double x#

The position of the stop line.

double y#
double orientation#

Natural direction of traffic going through the stop line, in radians like in AgentState.

std::optional<double> length#

Size of the stop line, in meters, along its orientation.

std::optional<double> width#
std::vector<int> dependant#
struct Point2d#

2D coordinates of a point in a given location. Each location comes with a canonical coordinate system, where the distance units are meters.

Public Functions

inline bool isCloseTo(const Point2d &other, double threshold = 1) const#

Public Members

double x#
double y#