Comments (6)
@mantkiew you seem to have provided the Geocentric code, do you have a good idea?
from lanelet2.
Or to make the code more consistent: For ECEF we do know the origin: It's the center of the earth. So how about for GeocentricProjector
we set the origin to GpsPoint{.lat = 90, .lon = 0, .ele = -6356752.3}
, i.e. the center of the earth?
from lanelet2.
Hi, the tutorial shows using loadRobust
, which does not take any origin, just the projector. https://github.com/fzi-forschungszentrum-informatik/Lanelet2/blob/33e797a5f4c3ac4cf4f63316fcd6965c9cf0cf57/lanelet2_examples/scripts/tutorial.py#L192C35-L192C35
I think it's the same with load
, not sure why it would complain about not providing the origin.
There's the old API, where you can give just an origin and it creates some bad default projector, but that should not be used. Always create the projector you want and use that consistently.
from lanelet2.
Hi @mantkiew , thanks for the reply. I tried that but failed, see below.
I think just passing a projector does make sense -- and the projectors which need an origin actually 'carry their own' origin with them (they get constructed from it). The load
API allows to pass only a projector, if that has the origin set. If not, we get the error I was reporting. My feeling is, that in the ECEF case we either should provide an origin (e.g. center of the earth) to satisfy this check or disable this check for projectors which do not need an origin.
For full reproducibility, here my console log:
% pip install lanelet2
Collecting lanelet2
...
Successfully installed lanelet2-1.2.1
% wget https://github.com/fzi-forschungszentrum-informatik/Lanelet2/raw/master/lanelet2_maps/res/mapping_example.osm
....
2023-12-05 16:53:22 (1.27 MB/s) - ‘mapping_example.osm’ saved [594826/594826]
% python
Python 3.8.10 (default, Nov 22 2023, 10:22:35)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lanelet2
>>> ecef_projector = lanelet2.projection.GeocentricProjector()
>>> m = lanelet2.io.loadRobust("mapping_example.osm", ecef_projector)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: You must pass an origin when loading a map with georeferenced (lat/lon) data!
So looking at the code I think load
and loadRobust
do the same thing, while one throws and the other prints.
from lanelet2.
This is the culprit (handleDefaultProjector
throws the exception) :
Lanelet2/lanelet2_io/include/lanelet2_io/io_handlers/IoHandler.h
Lines 34 to 39 in 33e797a
The GeocentricProjector does not use origin at all, because it's hardcoded in the underlying LibGeographic C++ library, and so it only has the default one defined in the class Projector:
So, to fix this: the GeocentricProjector should overwrite the origin with whatever value that is different from the default projector.
from lanelet2.
@poggenhans @immel-f this PR fixes this error. It also adds usage demonstration to tutorial.py
.
from lanelet2.
Related Issues (20)
- __init__() of Lanelet2.core.ReguratoryElement not supported in Python HOT 1
- [Question] Possible Paths other than shortest path from start to end lanelets HOT 6
- Add support for python type hints in python package HOT 6
- Map of Karlsruhe HOT 4
- Python: add node to existing lineString HOT 3
- How to do the same job as BinParser in lanelet2_io in Python HOT 5
- lanelet2_core build fails HOT 3
- Lanelet2_validation fail while catkin build HOT 3
- lanelet2_core fails to build on ROS 2 Rolling HOT 1
- Remove dependency of mrt_cmake_modules HOT 3
- lanelet2_io [ Exited with code 2 ] HOT 2
- When load an OSM file, is tag: one_way work? HOT 1
- lanelet2 don't output anything HOT 2
- Broken Links within Mkdocs Documentation HOT 2
- Route search by specifying impassable lanes HOT 4
- Lanelet2 3D Viz HOT 3
- Output of findWithin2d gives incomprehensible outputs when used on pointLayer of a known map HOT 2
- Automatically add role left and right to lanelet HOT 1
- ShortestPath Function including lanechange doesn't work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lanelet2.