pageldev / libopendrive Goto Github PK
View Code? Open in Web Editor NEWSmall, lightweight C++ library for handling OpenDRIVE files
License: Apache License 2.0
Small, lightweight C++ library for handling OpenDRIVE files
License: Apache License 2.0
i'm wondering about routing(path planning) on .xodr, which may require a node-edge based data structure, is there any plan or roadmap on implementing more OpenDrive features?
ps. libOpenDRIVE is a great project
The touch controls in odrviewer.io on Chrome mobile are not working.
Expectation:
I noticed that the it is not possible to rotate the view in https://odrviewer.io/ like it is in https://sebastian-pagel.net/odrviewer/
Also the direction of the mouse wheel zoom is inconsistent (between https://odrviewer.io/ and https://sebastian-pagel.net/odrviewer/).
I recommend you to use the same direction as https://www.google.com/maps/ does (also Blender and many other tools), since most of the people are used to that:
I want to get .obj file from the code How Could i get it..?!
In web site (https://odrviewer.io/), if i push 'export .obj' button, the screen become black like under picture.
How could i use the function? please explain the function, thank you.
One feature that could be quite nice would be to export the map to various different file formats, such as lanelet2, osm, rd5, etc.
Thank you for the great work for all of the contributors here!
I tried to access the Parampoly3 members but I think the data was not stored in the map reading step.
When I access Parampoly3, I used the code line below.
aU = road->ref_line->s0_to_geometry[0.0]->aU;
Steps to reproduce:
After these steps the selected details seems to not be applied to the newly loaded .xodr. Reselecting Detail = "High (0.01)" does its job.
this project help me a lot. thank youvery much.
i find it lose road signal mesh
In Util.hpp file, you using __FILE_NAME__ to get file name, but it is __FILE__ in my environment.
[ 47%] Building CXX object CMakeFiles/OpenDrive.dir/OpenDriveMap.cpp.o
In file included from /home/hero/project/simulation/libOpenDRIVE/RoadMark.h:4:0,
from /home/hero/project/simulation/libOpenDRIVE/Lanes.h:6,
from /home/hero/project/simulation/libOpenDRIVE/LaneSection.h:3,
from /home/hero/project/simulation/libOpenDRIVE/Road.h:4,
from /home/hero/project/simulation/libOpenDRIVE/OpenDriveMap.h:4,
from /home/hero/project/simulation/libOpenDRIVE/OpenDriveMap.cpp:1:
/home/hero/project/simulation/libOpenDRIVE/OpenDriveMap.cpp: In constructor ‘odr::OpenDriveMap::OpenDriveMap(std::__cxx11::string, bool, bool, bool)’:
/home/hero/project/simulation/libOpenDRIVE/Utils.hpp:25:53: error: ‘__FILE_NAME__’ was not declared in this scope
printf("[%s:%d %s] check failed: %s\n", __FILE_NAME__, __LINE__, __FUNCTION__, msg); \
^
/home/hero/project/simulation/libOpenDRIVE/OpenDriveMap.cpp:59:9: note: in expansion of macro ‘CHECK_AND_REPAIR’
CHECK_AND_REPAIR(road->length >= 0, "road::length < 0", road->length = 0);
^~~~~~~~~~~~~~~~
/home/hero/project/simulation/libOpenDRIVE/Utils.hpp:25:53: note: suggested alternative: ‘__FLT_MAX__’
printf("[%s:%d %s] check failed: %s\n", __FILE_NAME__, __LINE__, __FUNCTION__, msg); \
^
/home/hero/project/simulation/libOpenDRIVE/OpenDriveMap.cpp:59:9: note: in expansion of macro ‘CHECK_AND_REPAIR’
CHECK_AND_REPAIR(road->length >= 0, "road::length < 0", road->length = 0);
^~~~~~~~~~~~~~~~
/home/hero/project/simulation/libOpenDRIVE/Utils.hpp:25:53: error: ‘__FILE_NAME__’ was not declared in this scope
printf("[%s:%d %s] check failed: %s\n", __FILE_NAME__, __LINE__, __FUNCTION__, msg); \
Scroll to zoom direction between https://odrviewer.io/ and https://sebastian-pagel.net/odrviewer/index.html is inconsistent.
Can you make it as in Google Maps to make it intuitive for both apps:
Scroll up to zoom in and scroll down to zoom out
I happened to notice that the Viewer still looks like the old viewer from some months ago and not like the current one available at https://odrviewer.io/. Is there any plans to release the code for that as well and replace the current Viewer with it?
Is it possible that provide a function named get_roadid_st_list_by_xy in C++
Hello author, thank you very much for open source such a powerful library, I think it fills the gap of opendrive official does not provide parsing library.
I find that the signal element of opendrive may represent the signal element differently. Is that why you didn't parse signal?
I use the code following:
double s = odr_ref.match(destPoint[0], destPoint[1])
I want to use the destPoint to get the s,but the result of s isn't matched the real map, so can you offer some refference or the functions of the function.
this line should be
-s EXPORT_NAME='\"libOpenDrive\"' \
As per the Opendrive (1.6 and 1.7) documentation:
Complex objects may be further described using <outline> elements. If an <outline> is defined, it supersedes the bounding box.
Issue: In my case, element doesn't supersede object's attribute. I don't see any impact of element. As per above docs, Object should be drawn according to element if it is provided.
Here is a sample Object element with outline. This snippet can be placed inside any road object .
<objects>
<object type="crosswalk" id="10" s="10.0" t="0.0" zOffset="0.0"
orientation="none" length="15.0" width="10.0" hdg="0.0" pitch="0.0" roll="0.0">
<outlines>
<outline id="0">
<cornerRoad s="5.0" t="3.5" dz="0.0" height="4.0" id="0"/>
<cornerRoad s="8.0" t="-3.5" dz="0.0" height="4.0" id="1"/>
<cornerRoad s="12.0" t="-3.5" dz="0.0" height="4.0" id="2"/>
<cornerRoad s="15.0" t="3.5" dz="0.0" height="4.0" id="3"/>
</outline>
</outlines>
</object>
</objects>
How to reproduce:
References:
OD1.6 -> https://releases.asam.net/OpenDRIVE/1.6.0/ASAM_OpenDRIVE_BS_V1-6-0.html#_objects
OD1.7 -> https://www.asam.net/index.php?eID=dumpFile&t=f&f=4422&token=e590561f3c39aa2260e5442e29e93f6693d1cccd#top-e12007a5-2961-4fa0-9de7-cf748a4f26ab
I use 'get_xyz' function but the result coordinate is different from coordinate in 'https://sebastian-pagel.net/odrviewer/' .
How can i get world coordinate without error?
I want to use it in react, can you write a sample for me.
Thanks
In Lane.cpp, the function:
std::vector<RoadMark> Lane::get_roadmarks(double s_start, double s_end) const
I think there might be a bug in the comparison code for getting the upper_bound iterator as it currently is:
[](const double& s, const RoadMarkGroup& rmg) -> bool { return (rmg.lanesection_s0 + rmg.s_offset) < s; });
I think the comparison function for upper_bound should instead be:
[](const double& s, const RoadMarkGroup& rmg) -> bool { return s < (rmg.lanesection_s0 + rmg.s_offset); });
According to: https://en.cppreference.com/w/cpp/algorithm/upper_bound
The 1st argument 's' should compare less than the 2nd argument 'rmg'.
The comparison function for lower_bound later in the function is correct because 's' is the 2nd argument in that case.
I met the same problem slightly like this one https://github.com/grepthat/libOpenDRIVE/issues/49, and I also change the libOpenDRIVE/CMakeLists.txt as it suggested. But I still got the error below:
my gcc version is 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
I saw this file in your onilne viewer https://sebastian-pagel.net/libOpenDrive.js
but not in repo
and this file has been ignored in .gitigonre file
how to get it ?
thanks
Thank you. I appreciate it. I'd like to know how you calculated the equation for finding parampoly3 parameters at known control points. Thank you very much~
// at Lanes.cpp#187
for (const auto& s_roadmarks_line : roadmark_group.s_to_roadmarks_line)
{
const RoadMarksLine& roadmarks_line = s_roadmarks_line.second;
if (roadmarks_line.width > 0)
width = roadmarks_line.width;
// roadmarks_line.length + roadmarks_line.space equals zero in some xodr files
for (double s_start_single_roadmark = s_roadmarks_line.first; s_start_single_roadmark < s_end_roadmark_group;
s_start_single_roadmark += (roadmarks_line.length + roadmarks_line.space))
{
const double s_end_single_roadmark = std::min(s_end, s_start_single_roadmark + roadmarks_line.length);
roadmarks.push_back(
{s_start_single_roadmark, s_end_single_roadmark, roadmarks_line.t_offset, width, roadmark_group.type + roadmarks_line.name});
}
}
roadmarks_line.length + roadmarks_line.space equals zero in some xodr files
in addition, I want to further encapsulate this library with typescript. Any suggestions?
I see that there is parsing objects record in the c++ code, but I don't know how to draw with these data, can you please provide an example in the viewer or briefly describe how to use the road_objects_mesh
data?
Thanks!
Hi, do you know whether the web site odrviewer.io is opensource or not?
Thanks!
a e s t h e t i c
Awesome library! Once you are ready for the first release could you please add version Git tags? Preferably using semver 2.0 (https://semver.org/)
Hello,I am very interested in your project and I benefit a lot.Do you have any plans about adding association between opendrive map elements and related traffic rules or utilizing map data to generate a routing map?
Load this xodr
https://guard-strike.oss-cn-shanghai.aliyuncs.com/oasis/xodr/Town03.xodr
refline of road 1 is not between lane -1 and lane 1
The function likes that input the point coordinates in the world, output the point location in th map, including the RoidID, so much location infromaton as the s 、 t and LaneID.
error: no matching function for call to ‘isnan<double>(const double&)’
change isnan<double> to isnan (delete <double>)
Hi I'm trying to import obj file (exported from odrviewer) to Unreal Engine4.
When I import obj file, It shows shape of the road but I can't see any roadmarks, lane, reference line, and etc.
Am I missing any procedure or is this feature not supported originally?
I will be glad to receive any recommendations to help solving this problem.
I'm sorry to bother you again. I try to fit this road like number 8 with Bezier curve, but I find that my result is wavy line. Do I want to know what optimization method is available,thank you very much
First ,It's a great project. I am doing something like converting some data to opendrive files,but i met some problems by converting to ParamPoly3 geometry . I think maybe I will be inspired by this project,but i really don't understand how to build ParamPoly3 after i read the code. Could you please give me some explanations ? Thanks a lot~
Firstly, this is a really nice project.
There is a issue , i can not pick the road with my mouse point over the road, there is an offset between mouse and road.
May I ask what causes these problem
error:specialization of 'template struct std::less' in different namespace
Any plans about adding OpenScenario? like playing Scenarios according to the .xodr and .xosc files and make web animation.
Hi, I can't get valid lane coordinates, just added output in test.cpp of lane points, my output is all nan
for(auto p: lane_pts) { printf("%.2f %.2f %.2f\n", p[0], p[1], p[2]); }
./test-xodr ../Viewer/data.xodr
road: 500, length: 16.52
road: 501, length: 4.00
road: 502, length: 4.00
road: 503, length: 16.52
road: 504, length: 20.00
road: 505, length: 20.00
road: 506, length: 20.00
road: 507, length: 20.00
road: 508, length: 541.50
road: 509, length: 541.50
road: 510, length: 16.12
road: 511, length: 16.12
road: 512, length: 16.12
road: 513, length: 16.12
road: 514, length: 4.00
road: 515, length: 16.52
road: 516, length: 4.00
road: 517, length: 16.52
Finished, got 320 lane points, 256 roadmark points
-nan -nan -nan
-nan -nan -nan
-nan -nan -nan
-nan -nan -nan
-nan -nan -nan
-nan -nan -nan
-nan -nan -nan
-nan -nan -nan
-nan -nan -nan
Somehow on my machine (Ubuntu 22.04 LTS) compilation fails with the following errors:
libOpenDRIVE/include/Math.hpp:47:35: error: ‘plus’ is not a member of ‘std’
libOpenDRIVE/include/Math.hpp:53:35: error: ‘minus’ is not a member of ‘std’; did you mean ‘min’?
libOpenDRIVE/include/Math.hpp:80:66: error: ‘multiplies’ is not a member of ‘std’
Even though it should be in the standard of c++14 (https://en.cppreference.com/w/cpp/utility/functional/plus) compilation fails.
I've tried to update gcc and c++ from 9.4.0 to 11.3.0 but this did not resolve the issues.
After changing CMAKE_CXX_STANDARD to 17 or above, the issues are resolved (I still need to resolve #46 but after that, it works).
So for anyone else with issues like that, change https://github.com/grepthat/libOpenDRIVE/blob/master/CMakeLists.txt#L8 to set(CMAKE_CXX_STANDARD 17)
.
From my side this issue can immediately be resolved since it isn't an issue regarding this lib. But wanted to share the issue for anyone else having trouble.
I use 'get_xyz' function but the result coordinate is different from coordinate in 'https://sebastian-pagel.net/odrviewer/' .
How can i get world coordinate without error?
// at Lanes.cpp#187
for (const auto& s_roadmarks_line : roadmark_group.s_to_roadmarks_line)
{
const RoadMarksLine& roadmarks_line = s_roadmarks_line.second;
if (roadmarks_line.width > 0)
width = roadmarks_line.width;
// roadmarks_line.length + roadmarks_line.space equals zero in some xodr files
for (double s_start_single_roadmark = s_roadmarks_line.first; s_start_single_roadmark < s_end_roadmark_group;
s_start_single_roadmark += (roadmarks_line.length + roadmarks_line.space))
{
const double s_end_single_roadmark = std::min(s_end, s_start_single_roadmark + roadmarks_line.length);
roadmarks.push_back(
{s_start_single_roadmark, s_end_single_roadmark, roadmarks_line.t_offset, width, roadmark_group.type + roadmarks_line.name});
}
}
roadmarks_line.length + roadmarks_line.space equals zero in some xodr files
in addition, I want to further encapsulate this library with typescript. Any suggestions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.