Road network description. More...
#include <roadnet.hpp>
Public Member Functions | |
Eigen::Vector2i | get_intersection (size_t idx) const |
Get intersection in canonical coordinates. More... | |
double | get_intersection_mindist (size_t idx, double x, double y) const |
Get minimum distance from point to center of road intersection. More... | |
std::string | get_intersection_str (size_t idx) const |
size_t | get_nearest_intersection (double x, double y) const |
Get index of intersection nearest to x,y point. More... | |
size_t | get_nearest_segment (double x, double y) const |
Get index of segment nearest to x,y point. More... | |
double | get_segment_mindist (size_t idx, double x, double y) const |
Get minimum distance from point to center of road segment. More... | |
std::string | get_segment_str (size_t idx) const |
void | map_point (const int x, const int y, double &mapped_x, double &mapped_y) const |
Map point in local coordinates through transform and scaling. More... | |
const Eigen::Vector4d | mapped_segment (size_t idx, int lane=0) const |
Get mapped road segment. More... | |
int | number_of_intersections () const |
int | number_of_segments () const |
RoadNetwork (double length_, const Eigen::Vector3d &transform_, int shape0, int shape1) | |
Create RoadNetwork that is 4-connected grid of size (shape0, shape1). More... | |
RoadNetwork (std::istream &rndjson) | |
Create RoadNetwork from a description in a JSON container. More... | |
RoadNetwork (const std::string &rndjson) | |
RoadNetwork (const RoadNetwork &to_be_copied) | |
std::vector< size_t > | segments_at_end (size_t idx, bool reverse=false) const |
std::vector< size_t > | segments_at_start (size_t idx) const |
Friends | |
std::ostream & | operator<< (std::ostream &out, const RoadNetwork &rd) |
Output in RND format using JSON container to given stream. More... | |
Road network description.
This class serves a similar purpose to the class RoadNetwork in dubins_traffic.py of the fmrb Python package. However, this is considered the reference implementation.
dubins_traffic::RoadNetwork::RoadNetwork | ( | double | length_, |
const Eigen::Vector3d & | transform_, | ||
int | shape0, | ||
int | shape1 | ||
) |
Create RoadNetwork that is 4-connected grid of size (shape0, shape1).
dubins_traffic::RoadNetwork::RoadNetwork | ( | std::istream & | rndjson | ) |
Create RoadNetwork from a description in a JSON container.
segments is not yet implemented. Thus, until then, it is only possible to define a 4-connected grid using shape.
Eigen::Vector2i dubins_traffic::RoadNetwork::get_intersection | ( | size_t | idx | ) | const |
Get intersection in canonical coordinates.
double dubins_traffic::RoadNetwork::get_intersection_mindist | ( | size_t | idx, |
double | x, | ||
double | y | ||
) | const |
Get minimum distance from point to center of road intersection.
size_t dubins_traffic::RoadNetwork::get_nearest_intersection | ( | double | x, |
double | y | ||
) | const |
Get index of intersection nearest to x,y point.
size_t dubins_traffic::RoadNetwork::get_nearest_segment | ( | double | x, |
double | y | ||
) | const |
Get index of segment nearest to x,y point.
double dubins_traffic::RoadNetwork::get_segment_mindist | ( | size_t | idx, |
double | x, | ||
double | y | ||
) | const |
Get minimum distance from point to center of road segment.
void dubins_traffic::RoadNetwork::map_point | ( | const int | x, |
const int | y, | ||
double & | mapped_x, | ||
double & | mapped_y | ||
) | const |
Map point in local coordinates through transform and scaling.
This function does not check whether the given point is on some segment.
const Eigen::Vector4d dubins_traffic::RoadNetwork::mapped_segment | ( | size_t | idx, |
int | lane = 0 |
||
) | const |
Get mapped road segment.
|
friend |
Output in RND format using JSON container to given stream.