diff --git a/include/opendrive_road.h b/include/opendrive_road.h index 70736390774e5a71849852d64f09ea9740516606..b38b32a2b4466377072908d346549f22436c98ef 100644 --- a/include/opendrive_road.h +++ b/include/opendrive_road.h @@ -41,22 +41,158 @@ class COpendriveRoad void reindex(void); void prune(std::vector<unsigned int> &path_nodes); public: + /** + * \brief Default constructor + */ COpendriveRoad(); + /** + * \brief Copy constructor + * + * \param object constant reference to the object to be copied + */ COpendriveRoad(const COpendriveRoad& object); + /** + * \brief Load an Opendrive road description + * + * This function loads the Opendrive description file initializes the internal + * data structures. If the file referenced by the parameter does not exist or + * the format is not valid, this function will throw an exception. + * + * \param filename the name of the opendrive file to load with the extension + * and the full path. + */ void load(const std::string &filename); + /** + * \brief Sets the resolution + * + * This functions sets the default resolution used to generate all the internal + * geomtry. This functions automatically changes the resolution of all underlying + * objects. + * + * \param res desired value of the resolution in meters. The default resolution + * is 0.1 m. + */ void set_resolution(double res); + /** + * \brief Sets the scale factor + * + * This function sets the scale factor to be applied to all the internal geometry. + * The scale factor makes it possible to change the size of the road withou actually + * modifying the internal geometry data. This functions automatically changes + * the scale factor of all underlying objects. + * + * \param scale desired scale factor. A value bigger than 1.0 will scale down the + * road and a value smaller than 1.0 will scale it up. The default + * value is 1.0. + */ void set_scale_factor(double scale); + /** + * \brief Sets the minim road length + * + * This function sets the length threshold to include any imported road segments into + * the internal structure. This functions automatically changes the minimum road length + * of all underlying objects. + * + * \param length threshold value to include a road segment. The default value is 0.01. + */ void set_min_road_length(double length); + /** + * \brief Returns the resolution + * + * \return This function returns the current resolution + */ double get_resolution(void) const; + /** + * \brief Returns the scale factor + * + * \return This function returns the current scale factor + */ double get_scale_factor(void) const; + /** + * \brief Returns the minimum road length + * + * \return This function returns the current minimum road length + */ double get_min_road_length(void) const; + /** + * \brief Returns the number of road segment objects in the whole road + * + * \return This function returns the number of road segments present in + * whole road. The range of valid indexes goes from 0 to the + * value returned by this function -1. + */ unsigned int get_num_segments(void) const; + /** + * \brief Returns a road segment by index + * + * This function returns a constant reference to the desired road segment + * object, which can not be modified by the user. If the index is not valid, + * this function will throw an exception. + * + * \param index is the 0 based index of the desired road segment + * + * \return constant reference to the desired road segment object. + */ const COpendriveRoadSegment& get_segment(unsigned int index) const; + /** + * \brief Returns the number of lane objects in the whole road + * + * \return This function returns the number of lanes present in whole + * road. The range of valid indexes goes from 0 to the value + * returned by this function -1. + */ unsigned int get_num_lanes(void) const; + /** + * \brief Returns a lane by index + * + * This function returns a constant reference to the desired lane + * object, which can not be modified by the user. If the index is not valid, + * this function will throw an exception. + * + * \param index is the 0 based index of the desired lane + * + * \return constant reference to the desired lane object. + */ const COpendriveLane &get_lane(unsigned int index) const; + /** + * \brief Returns the number of road node objects in the whole road + * + * \return This function returns the number of road nodes present in whole + * road. The range of valid indexes goes from 0 to the value + * returned by this function -1. + */ unsigned int get_num_nodes(void) const; + /** + * \brief Returns a road node by index + * + * This function returns a constant reference to the desired road node + * object, which can not be modified by the user. If the index is not valid, + * this function will throw an exception. + * + * \param index is the 0 based index of the desired road node + * + * \return constant reference to the desired road node object. + */ const COpendriveRoadNode& get_node(unsigned int index) const; + /** + * \brief overloaded index operator + * + * This operator is similar to the get_segment() function. It returns a + * constant reference to the desired road segment object, which can not + * be modified by the user. If the index is not valid,this function will + * throw an exception. + * + * \param index is the 0 based index of the desired road segment + * + * \return constant reference to the desired road segment object. + */ const COpendriveRoadSegment &operator[](std::size_t index); + /** + * \brief gets the closest node to a given point + * + * This functions searches all the road nodes for the one which is closest to + * a given position and returns it. The distance from the closest node to the + */ const COpendriveRoadNode &get_closest_node(TOpendriveWorldPose &pose,double &distance,double angle_tol=0.1) const; unsigned int get_closest_node_index(TOpendriveWorldPose &pose,double &distance,double angle_tol=0.1) const; const COpendriveLane &get_closest_lane(TOpendriveWorldPose &pose,double &distance,double angle_tol=0.1) const;