Skip to content

yuzhangbit/lanelet2_standalone

 
 

Repository files navigation

lanelet2_standalone

Overview

This is a standalone lanelet2 python3/python2 package for the Lanelet2 library, which does not require the ROS and catkin.

Installation

pylanelet2 uses cmake and setuptools for building and packaging and is targeted towards Linux.

At least C++14 is required.

Tested Configuration

  • Ubuntu 16.04 LTS
  • python2.7/python3.5

Dependencies

  • Boost (from 1.58, for lanelet2_io)
  • eigen3
  • pugixml (for lanelet2_io)
  • boost-python2/python3
  • geographiclib (for lanelet2_projection)

For Ubuntu:

sudo apt-get install -y cmake \
    libboost-all-dev  \
    libeigen3-dev \
    libgeographic-dev \
    libpugixml-dev \
    libpython-dev \
    libboost-python-dev \
    libpython3-all-dev \
    python3-pip \
    python3-setuptools \
    python-pip \
    python-setuptools

Installing

  • Building
git clone https://github.com/yuzhangbit/lanelet2_standalone.git
cd lanelet2_standalone
  • Install lanelet2 for system python3:
sudo python3 setup.py install
  • Or install lanelet2 for system python2:
sudo python setup.py install
  • Or install lanelet2 for other python version:
/path/to/python setup.py install
  • For whom wants to use the lanelet2 standalone c++ library (optional), do
cd lanelet2_standalone
mkdir -p build
cd build
cmake ..
make -j$(nproc)
sudo make install

Usage

Example

#!/usr/bin/env python
import lanelet2
from lanelet2 import core, io, projection, geometry, routing, traffic_rules
# or
from lanelet2.core import Lanelet, LineString3d, Point2d, Point3d, getId, LaneletMap, BoundingBox2d, BasicPoint2d
p = Point3d(getId(), 1, 100, 1000)
print(p)
assert p.x == 1
p.id = getId()

Note: Importing submodules from the raw liblanelet2_core_pyapi.so library like below is not supported. If you do this,

from lanelet2.liblanelet2_core_pyapi import AttributeMap # not supported!!!

you will get an error as below:

>>> from lanelet2.liblanelet2_core_pyapi import AttributeMap
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'lanelet2.liblanelet2_core_pyapi'

Instead, you can use

from lanelet2 import core
# use core.AttributeMap
# or
from lanelet2.core import AttributeMap

, which is more elegant.

About

A standalone lanelet2 python3/python2 package for the Lanelet2 library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 94.6%
  • CMake 2.8%
  • Python 1.8%
  • HTML 0.8%