kompass-core 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kompass_core-0.2.2/LICENSE +21 -0
- kompass_core-0.2.2/MANIFEST.in +1 -0
- kompass_core-0.2.2/PKG-INFO +156 -0
- kompass_core-0.2.2/README.md +106 -0
- kompass_core-0.2.2/pyproject.toml +113 -0
- kompass_core-0.2.2/setup.cfg +4 -0
- kompass_core-0.2.2/setup.py +200 -0
- kompass_core-0.2.2/src/kompass_core/__init__.py +0 -0
- kompass_core-0.2.2/src/kompass_core/algorithms/__init__.py +3 -0
- kompass_core-0.2.2/src/kompass_core/algorithms/dvz.py +519 -0
- kompass_core-0.2.2/src/kompass_core/calibration.py +245 -0
- kompass_core-0.2.2/src/kompass_core/control/__init__.py +94 -0
- kompass_core-0.2.2/src/kompass_core/control/_base_.py +320 -0
- kompass_core-0.2.2/src/kompass_core/control/_trajectory_.py +43 -0
- kompass_core-0.2.2/src/kompass_core/control/dvz.py +284 -0
- kompass_core-0.2.2/src/kompass_core/control/dwa.py +299 -0
- kompass_core-0.2.2/src/kompass_core/control/stanley.py +222 -0
- kompass_core-0.2.2/src/kompass_core/datatypes/__init__.py +34 -0
- kompass_core-0.2.2/src/kompass_core/datatypes/laserscan.py +152 -0
- kompass_core-0.2.2/src/kompass_core/datatypes/obstacles.py +308 -0
- kompass_core-0.2.2/src/kompass_core/datatypes/path.py +599 -0
- kompass_core-0.2.2/src/kompass_core/datatypes/pointcloud.py +60 -0
- kompass_core-0.2.2/src/kompass_core/datatypes/pose.py +205 -0
- kompass_core-0.2.2/src/kompass_core/mapping/__init__.py +8 -0
- kompass_core-0.2.2/src/kompass_core/mapping/bresenham.py +219 -0
- kompass_core-0.2.2/src/kompass_core/mapping/grid.py +276 -0
- kompass_core-0.2.2/src/kompass_core/mapping/laserscan_model.py +114 -0
- kompass_core-0.2.2/src/kompass_core/mapping/local_mapper.py +283 -0
- kompass_core-0.2.2/src/kompass_core/models.py +1352 -0
- kompass_core-0.2.2/src/kompass_core/motion_cost.py +441 -0
- kompass_core-0.2.2/src/kompass_core/performance.py +289 -0
- kompass_core-0.2.2/src/kompass_core/py_path_tools/__init__.py +4 -0
- kompass_core-0.2.2/src/kompass_core/py_path_tools/executor.py +683 -0
- kompass_core-0.2.2/src/kompass_core/py_path_tools/interpolation.py +383 -0
- kompass_core-0.2.2/src/kompass_core/simulation.py +327 -0
- kompass_core-0.2.2/src/kompass_core/third_party/__init__.py +0 -0
- kompass_core-0.2.2/src/kompass_core/third_party/fcl/__init__.py +0 -0
- kompass_core-0.2.2/src/kompass_core/third_party/fcl/collisions.py +115 -0
- kompass_core-0.2.2/src/kompass_core/third_party/fcl/config.py +34 -0
- kompass_core-0.2.2/src/kompass_core/third_party/ompl/__init__.py +0 -0
- kompass_core-0.2.2/src/kompass_core/third_party/ompl/config.py +162 -0
- kompass_core-0.2.2/src/kompass_core/third_party/ompl/planner.py +518 -0
- kompass_core-0.2.2/src/kompass_core/utils/__init__.py +0 -0
- kompass_core-0.2.2/src/kompass_core/utils/common.py +569 -0
- kompass_core-0.2.2/src/kompass_core/utils/geometry.py +460 -0
- kompass_core-0.2.2/src/kompass_core/utils/visualization.py +221 -0
- kompass_core-0.2.2/src/kompass_core.egg-info/PKG-INFO +156 -0
- kompass_core-0.2.2/src/kompass_core.egg-info/SOURCES.txt +85 -0
- kompass_core-0.2.2/src/kompass_core.egg-info/dependency_links.txt +1 -0
- kompass_core-0.2.2/src/kompass_core.egg-info/not-zip-safe +1 -0
- kompass_core-0.2.2/src/kompass_core.egg-info/requires.txt +16 -0
- kompass_core-0.2.2/src/kompass_core.egg-info/top_level.txt +3 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/controllers/controller.h +97 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/controllers/dwa.h +136 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/controllers/follower.h +275 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/controllers/pid.h +58 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/controllers/stanley.h +96 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/datatypes/control.h +65 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/datatypes/parameter.h +277 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/datatypes/path.h +89 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/datatypes/trajectory.h +52 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/utils/angles.h +10 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/utils/collision_check.h +280 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/utils/cost_evaluator.h +275 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/utils/logger.h +122 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/utils/spline.h +645 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/utils/trajectory_sampler.h +205 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/include/utils/transformation.h +90 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/src/bindings.cpp +384 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/src/controllers/controller.cpp +91 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/src/controllers/dwa.cpp +273 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/src/controllers/follower.cpp +327 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/src/controllers/pid.cpp +52 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/src/controllers/stanley.cpp +112 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/src/datatypes/path.cpp +248 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/src/utils/angles.cpp +25 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/src/utils/collision_check.cpp +335 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/src/utils/cost_evaluator.cpp +256 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/src/utils/trajectory_sampler.cpp +351 -0
- kompass_core-0.2.2/src/kompass_cpp/kompass_cpp/src/utils/transformation.cpp +149 -0
- kompass_core-0.2.2/src/kompass_cpp/tests/trajectory_sampler_plt.py +84 -0
- kompass_core-0.2.2/src/ompl/src/bindings.cpp +485 -0
- kompass_core-0.2.2/tests/test_controllers.py +456 -0
- kompass_core-0.2.2/tests/test_fcl.py +351 -0
- kompass_core-0.2.2/tests/test_laserscan.py +126 -0
- kompass_core-0.2.2/tests/test_local_mapper_pytest.py +273 -0
- kompass_core-0.2.2/tests/test_ompl.py +245 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Automatika Robotics
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
recursive-include src *.h
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: kompass_core
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Navigation Algorithms for Kompass
|
|
5
|
+
Author-email: Automatika Robotics <contact@automatikarobotics.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2024 Automatika Robotics
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Keywords: robotics,robots,navigation,control,planning,mapping
|
|
29
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
30
|
+
Classifier: Programming Language :: Python
|
|
31
|
+
Classifier: Programming Language :: Python :: 3
|
|
32
|
+
Requires-Python: <3.13,>=3.8.4
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
License-File: LICENSE
|
|
35
|
+
Requires-Dist: numpy<=1.26.4
|
|
36
|
+
Requires-Dist: numpy-quaternion>=2023.0.3
|
|
37
|
+
Requires-Dist: python-fcl-fork
|
|
38
|
+
Requires-Dist: pybind11
|
|
39
|
+
Requires-Dist: omegaconf
|
|
40
|
+
Requires-Dist: attrs>=23.2.0
|
|
41
|
+
Requires-Dist: numba
|
|
42
|
+
Requires-Dist: pyyaml
|
|
43
|
+
Requires-Dist: scipy
|
|
44
|
+
Requires-Dist: matplotlib
|
|
45
|
+
Requires-Dist: pandas
|
|
46
|
+
Provides-Extra: dev
|
|
47
|
+
Requires-Dist: pip-tools; extra == "dev"
|
|
48
|
+
Requires-Dist: pytest==8.0.0; extra == "dev"
|
|
49
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
50
|
+
|
|
51
|
+
# Kompass Core
|
|
52
|
+
|
|
53
|
+
Kompass Core is a motion planning and control package for robot navigation. The package contains C++ implementation for core algorithms along with Python wrappers. It also implements third party integrations with [OMPL](https://ompl.kavrakilab.org/) and [FCL](https://github.com/flexible-collision-library/fcl). This package is developed to be used with [Kompass](https://github.com/automatika-robotics/kompass) package for creating navigation stacks in [ROS2](https://docs.ros.org/en/rolling/index.html). For detailed usage documentation, check Kompass [docs](https://automatika-robotics.github.io/kompass/).
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
### Install Dependencies
|
|
58
|
+
|
|
59
|
+
- `sudo apt-get install libompl-dev libfcl-dev libpcl-dev`
|
|
60
|
+
|
|
61
|
+
### Install with pip
|
|
62
|
+
|
|
63
|
+
Wheels are available on Pypi for linux x86_64 and aarch64 architectures.
|
|
64
|
+
|
|
65
|
+
- `pip install kompass-core`
|
|
66
|
+
|
|
67
|
+
### Install from Source
|
|
68
|
+
|
|
69
|
+
- `git clone https://github.com/automatika-robotics/kompass-core`
|
|
70
|
+
- `cd kompass-core`
|
|
71
|
+
- `pip install .`
|
|
72
|
+
|
|
73
|
+
Installation with pip will install three Python package:
|
|
74
|
+
|
|
75
|
+
- `kompass_core`: The main Python API containing all the wrappers and utilities for motion planning and control for navigation in 2D spaces.
|
|
76
|
+
- `kompass_cpp`: Pybind11 python bindings for Kompass core C++ library containing the algorithms implementation for path tracking and motion control.
|
|
77
|
+
- `ompl`: Bespoke Pybind11 python bindings for the Open Motion Planning Library (OMPL).
|
|
78
|
+
|
|
79
|
+
## Testing
|
|
80
|
+
|
|
81
|
+
### Run Planning Test
|
|
82
|
+
|
|
83
|
+
- `cd tests`
|
|
84
|
+
- `python3 test_ompl.py`
|
|
85
|
+
|
|
86
|
+
To test path planning using OMPL bindings a reference planning problem is provided using Turtlebot3 Waffle map and fixed start and end position. The test will simulate the planning problem for all geometric planners for the number of desired repetitions to get average values.
|
|
87
|
+
|
|
88
|
+
### Run Controllers Test
|
|
89
|
+
|
|
90
|
+
- `cd tests`
|
|
91
|
+
- `python3 test_controllers.py`
|
|
92
|
+
|
|
93
|
+
The test will simulate path tracking using a reference global path. The results plot for each available controller will be generated in tests/resources/control
|
|
94
|
+
|
|
95
|
+
## Usage Example
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from kompass_core.control import DVZ
|
|
99
|
+
|
|
100
|
+
from kompass_core.models import (
|
|
101
|
+
AngularCtrlLimits,
|
|
102
|
+
LinearCtrlLimits,
|
|
103
|
+
Robot,
|
|
104
|
+
RobotCtrlLimits,
|
|
105
|
+
RobotGeometry,
|
|
106
|
+
RobotType,
|
|
107
|
+
)
|
|
108
|
+
from nav_msgs.msg import Path
|
|
109
|
+
|
|
110
|
+
# Setup the robot
|
|
111
|
+
my_robot = Robot(
|
|
112
|
+
robot_type=RobotType.ACKERMANN,
|
|
113
|
+
geometry_type=RobotGeometry.Type.CYLINDER,
|
|
114
|
+
geometry_params=np.array([0.1, 0.4]),
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
# Set the robot control limits
|
|
118
|
+
robot_ctr_limits = RobotCtrlLimits(
|
|
119
|
+
vx_limits=LinearCtrlLimits(max_vel=1.0, max_acc=5.0, max_decel=10.0),
|
|
120
|
+
omega_limits=AngularCtrlLimits(
|
|
121
|
+
max_vel=2.0, max_acc=3.0, max_decel=3.0, max_steer=np.pi
|
|
122
|
+
),
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
# Set the control time step (s)
|
|
126
|
+
control_time_step = 0.1 # seconds
|
|
127
|
+
|
|
128
|
+
# Initialize the controller
|
|
129
|
+
dvz = DVZ(
|
|
130
|
+
robot=my_robot,
|
|
131
|
+
ctrl_limits=robot_ctr_limits,
|
|
132
|
+
control_time_step=control_time_step,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
# Set the reference path
|
|
136
|
+
global_path : Path = Path()
|
|
137
|
+
|
|
138
|
+
# Set the reference path for the motion control
|
|
139
|
+
dvz.set_path(global_path)
|
|
140
|
+
|
|
141
|
+
# Get the sensor data
|
|
142
|
+
laser_scan = LaserScanData()
|
|
143
|
+
|
|
144
|
+
# At each control step run
|
|
145
|
+
dvz.loop_step(current_state=robot.state, laser_scan=laser_scan)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Copyright
|
|
149
|
+
|
|
150
|
+
The code in this distribution is Copyright (c) 2024 Automatika Robotics unless explicitly indicated otherwise.
|
|
151
|
+
|
|
152
|
+
Kompass Core is made available under the MIT license. Details can be found in the [LICENSE](LICENSE) file.
|
|
153
|
+
|
|
154
|
+
## Contributions
|
|
155
|
+
|
|
156
|
+
Kompass Core has been developed in collaboration between [Automatika Robotics](https://automatikarobotics.com/) and [Inria](https://inria.fr/). Contributions from the community are most welcome.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Kompass Core
|
|
2
|
+
|
|
3
|
+
Kompass Core is a motion planning and control package for robot navigation. The package contains C++ implementation for core algorithms along with Python wrappers. It also implements third party integrations with [OMPL](https://ompl.kavrakilab.org/) and [FCL](https://github.com/flexible-collision-library/fcl). This package is developed to be used with [Kompass](https://github.com/automatika-robotics/kompass) package for creating navigation stacks in [ROS2](https://docs.ros.org/en/rolling/index.html). For detailed usage documentation, check Kompass [docs](https://automatika-robotics.github.io/kompass/).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### Install Dependencies
|
|
8
|
+
|
|
9
|
+
- `sudo apt-get install libompl-dev libfcl-dev libpcl-dev`
|
|
10
|
+
|
|
11
|
+
### Install with pip
|
|
12
|
+
|
|
13
|
+
Wheels are available on Pypi for linux x86_64 and aarch64 architectures.
|
|
14
|
+
|
|
15
|
+
- `pip install kompass-core`
|
|
16
|
+
|
|
17
|
+
### Install from Source
|
|
18
|
+
|
|
19
|
+
- `git clone https://github.com/automatika-robotics/kompass-core`
|
|
20
|
+
- `cd kompass-core`
|
|
21
|
+
- `pip install .`
|
|
22
|
+
|
|
23
|
+
Installation with pip will install three Python package:
|
|
24
|
+
|
|
25
|
+
- `kompass_core`: The main Python API containing all the wrappers and utilities for motion planning and control for navigation in 2D spaces.
|
|
26
|
+
- `kompass_cpp`: Pybind11 python bindings for Kompass core C++ library containing the algorithms implementation for path tracking and motion control.
|
|
27
|
+
- `ompl`: Bespoke Pybind11 python bindings for the Open Motion Planning Library (OMPL).
|
|
28
|
+
|
|
29
|
+
## Testing
|
|
30
|
+
|
|
31
|
+
### Run Planning Test
|
|
32
|
+
|
|
33
|
+
- `cd tests`
|
|
34
|
+
- `python3 test_ompl.py`
|
|
35
|
+
|
|
36
|
+
To test path planning using OMPL bindings a reference planning problem is provided using Turtlebot3 Waffle map and fixed start and end position. The test will simulate the planning problem for all geometric planners for the number of desired repetitions to get average values.
|
|
37
|
+
|
|
38
|
+
### Run Controllers Test
|
|
39
|
+
|
|
40
|
+
- `cd tests`
|
|
41
|
+
- `python3 test_controllers.py`
|
|
42
|
+
|
|
43
|
+
The test will simulate path tracking using a reference global path. The results plot for each available controller will be generated in tests/resources/control
|
|
44
|
+
|
|
45
|
+
## Usage Example
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from kompass_core.control import DVZ
|
|
49
|
+
|
|
50
|
+
from kompass_core.models import (
|
|
51
|
+
AngularCtrlLimits,
|
|
52
|
+
LinearCtrlLimits,
|
|
53
|
+
Robot,
|
|
54
|
+
RobotCtrlLimits,
|
|
55
|
+
RobotGeometry,
|
|
56
|
+
RobotType,
|
|
57
|
+
)
|
|
58
|
+
from nav_msgs.msg import Path
|
|
59
|
+
|
|
60
|
+
# Setup the robot
|
|
61
|
+
my_robot = Robot(
|
|
62
|
+
robot_type=RobotType.ACKERMANN,
|
|
63
|
+
geometry_type=RobotGeometry.Type.CYLINDER,
|
|
64
|
+
geometry_params=np.array([0.1, 0.4]),
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Set the robot control limits
|
|
68
|
+
robot_ctr_limits = RobotCtrlLimits(
|
|
69
|
+
vx_limits=LinearCtrlLimits(max_vel=1.0, max_acc=5.0, max_decel=10.0),
|
|
70
|
+
omega_limits=AngularCtrlLimits(
|
|
71
|
+
max_vel=2.0, max_acc=3.0, max_decel=3.0, max_steer=np.pi
|
|
72
|
+
),
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
# Set the control time step (s)
|
|
76
|
+
control_time_step = 0.1 # seconds
|
|
77
|
+
|
|
78
|
+
# Initialize the controller
|
|
79
|
+
dvz = DVZ(
|
|
80
|
+
robot=my_robot,
|
|
81
|
+
ctrl_limits=robot_ctr_limits,
|
|
82
|
+
control_time_step=control_time_step,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
# Set the reference path
|
|
86
|
+
global_path : Path = Path()
|
|
87
|
+
|
|
88
|
+
# Set the reference path for the motion control
|
|
89
|
+
dvz.set_path(global_path)
|
|
90
|
+
|
|
91
|
+
# Get the sensor data
|
|
92
|
+
laser_scan = LaserScanData()
|
|
93
|
+
|
|
94
|
+
# At each control step run
|
|
95
|
+
dvz.loop_step(current_state=robot.state, laser_scan=laser_scan)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Copyright
|
|
99
|
+
|
|
100
|
+
The code in this distribution is Copyright (c) 2024 Automatika Robotics unless explicitly indicated otherwise.
|
|
101
|
+
|
|
102
|
+
Kompass Core is made available under the MIT license. Details can be found in the [LICENSE](LICENSE) file.
|
|
103
|
+
|
|
104
|
+
## Contributions
|
|
105
|
+
|
|
106
|
+
Kompass Core has been developed in collaboration between [Automatika Robotics](https://automatikarobotics.com/) and [Inria](https://inria.fr/). Contributions from the community are most welcome.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0", "wheel", "pybind11>=2.10.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "kompass_core"
|
|
7
|
+
version = "0.2.2"
|
|
8
|
+
description = "Navigation Algorithms for Kompass"
|
|
9
|
+
authors = [{ name = "Automatika Robotics", email = "contact@automatikarobotics.com" }]
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
classifiers = [
|
|
12
|
+
"License :: OSI Approved :: MIT License",
|
|
13
|
+
"Programming Language :: Python",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
]
|
|
16
|
+
license = { file = "LICENSE" }
|
|
17
|
+
|
|
18
|
+
keywords = ["robotics", "robots", "navigation", "control", "planning", "mapping"]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"numpy<=1.26.4",
|
|
21
|
+
"numpy-quaternion>=2023.0.3",
|
|
22
|
+
"python-fcl-fork",
|
|
23
|
+
"pybind11",
|
|
24
|
+
"omegaconf",
|
|
25
|
+
"attrs>=23.2.0",
|
|
26
|
+
"numba",
|
|
27
|
+
"pyyaml",
|
|
28
|
+
"scipy",
|
|
29
|
+
"matplotlib",
|
|
30
|
+
"pandas",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
requires-python = ">=3.8.4,<3.13"
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
dev = ["pip-tools", "pytest==8.0.0", "pre-commit"]
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
where = ["src"]
|
|
40
|
+
|
|
41
|
+
[tool.pytest.ini_options]
|
|
42
|
+
minversion = "6.0"
|
|
43
|
+
addopts = "-ra -q"
|
|
44
|
+
log_cli = true
|
|
45
|
+
log_cli_level = "INFO"
|
|
46
|
+
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s"
|
|
47
|
+
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
|
|
48
|
+
testpaths = [
|
|
49
|
+
"tests"
|
|
50
|
+
]
|
|
51
|
+
python_files = 'test*.py'
|
|
52
|
+
|
|
53
|
+
[tool.interrogate]
|
|
54
|
+
ignore-init-method = true
|
|
55
|
+
ignore-init-module = false
|
|
56
|
+
ignore-magic = false
|
|
57
|
+
ignore-semiprivate = false
|
|
58
|
+
ignore-private = false
|
|
59
|
+
ignore-property-decorators = false
|
|
60
|
+
ignore-module = true
|
|
61
|
+
ignore-nested-functions = false
|
|
62
|
+
ignore-nested-classes = true
|
|
63
|
+
ignore-setters = false
|
|
64
|
+
exclude = ["setup.py", "docs", "build", "tests"]
|
|
65
|
+
ignore-regex = ["^get$", "^mock_.*", ".*BaseClass.*"]
|
|
66
|
+
quiet = false
|
|
67
|
+
whitelist-regex = []
|
|
68
|
+
color = true
|
|
69
|
+
generate-badge = "."
|
|
70
|
+
badge-format = "svg"
|
|
71
|
+
|
|
72
|
+
[tool.ruff]
|
|
73
|
+
extend-exclude = [".mypy_cache", ".tox", ".venv", "buck-out", "build", ".pytest_cache"]
|
|
74
|
+
fix = true
|
|
75
|
+
line-length = 88
|
|
76
|
+
preview = true
|
|
77
|
+
[tool.ruff.lint]
|
|
78
|
+
ignore = ["E203", "E266", "E501", "F403", "F401"]
|
|
79
|
+
select = ["B","C","E","F","W","B9"]
|
|
80
|
+
[tool.ruff.lint.mccabe]
|
|
81
|
+
max-complexity = 10
|
|
82
|
+
|
|
83
|
+
[tool.bumpver]
|
|
84
|
+
current_version = "0.2.2"
|
|
85
|
+
version_pattern = "MAJOR.MINOR.PATCH"
|
|
86
|
+
commit_message = "(chore) Bump version {old_version} -> {new_version}"
|
|
87
|
+
tag_message = "{new_version}"
|
|
88
|
+
tag_scope = "default"
|
|
89
|
+
pre_commit_hook = ""
|
|
90
|
+
post_commit_hook = ""
|
|
91
|
+
commit = true
|
|
92
|
+
tag = true
|
|
93
|
+
push = true
|
|
94
|
+
|
|
95
|
+
[tool.bumpver.file_patterns]
|
|
96
|
+
"pyproject.toml" = [
|
|
97
|
+
'version = "{version}"',
|
|
98
|
+
]
|
|
99
|
+
"setup.py" = [
|
|
100
|
+
"{version}",
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
[tool.cibuildwheel]
|
|
104
|
+
skip = ["pp*", "*musllinux*"]
|
|
105
|
+
test-requires = "pytest"
|
|
106
|
+
test-command = "pytest {package}/tests/test_fcl.py"
|
|
107
|
+
manylinux-x86_64-image = "manylinux_2_28"
|
|
108
|
+
manylinux-aarch64-image = "manylinux_2_28"
|
|
109
|
+
|
|
110
|
+
[tool.cibuildwheel.linux]
|
|
111
|
+
environment = {VCPKG_ROOT="/project/deps/vcpkg", LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$VCPKG_ROOT/installed/x64-linux/lib:$VCPKG_ROOT/installed/arm64-linux/lib"}
|
|
112
|
+
before-all = "bash build_dependencies/install_linux.sh"
|
|
113
|
+
archs = ["x86_64"]
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import glob
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
from pybind11.setup_helpers import (
|
|
6
|
+
Pybind11Extension,
|
|
7
|
+
build_ext,
|
|
8
|
+
ParallelCompile,
|
|
9
|
+
naive_recompile,
|
|
10
|
+
)
|
|
11
|
+
from setuptools import find_packages, setup
|
|
12
|
+
import subprocess
|
|
13
|
+
|
|
14
|
+
__version__ = "0.2.2"
|
|
15
|
+
|
|
16
|
+
# DEFAULTS FOR UBUNTU 22.04
|
|
17
|
+
OMPL_INCLUDE_DEFAULT_DIR = "/usr/include/ompl-1.5"
|
|
18
|
+
EIGEN_INCLUDE_DEFAULT_DIR = "/usr/include/eigen3"
|
|
19
|
+
PCL_INCLUDE_DEFAULT_DIR = "/usr/include/pcl-1.12"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def get_libraries_dir():
|
|
23
|
+
"""Get libraries dir"""
|
|
24
|
+
lib_dirs = ["/usr/lib", "/usr/local/lib", "/usr/lib/x86_64-linux-gnu"]
|
|
25
|
+
|
|
26
|
+
if "LD_LIBRARY_PATH" in os.environ:
|
|
27
|
+
lib_dirs += os.environ["LD_LIBRARY_PATH"].split(":")
|
|
28
|
+
return lib_dirs
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def check_pkg_config():
|
|
32
|
+
"""Check if pkg-config is installed"""
|
|
33
|
+
try:
|
|
34
|
+
subprocess.check_output(["pkg-config", "--version"])
|
|
35
|
+
except subprocess.CalledProcessError as e:
|
|
36
|
+
raise RuntimeError(
|
|
37
|
+
"pkg-config is not installed, but it is required for building this package."
|
|
38
|
+
) from e
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def find_pkg(package, versions=None):
|
|
42
|
+
"""Find a given package using pkg-config"""
|
|
43
|
+
if not versions:
|
|
44
|
+
try:
|
|
45
|
+
subprocess.check_output(["pkg-config", "--exists", package])
|
|
46
|
+
print(f"FOUND {package}")
|
|
47
|
+
return package
|
|
48
|
+
except subprocess.CalledProcessError:
|
|
49
|
+
return
|
|
50
|
+
else:
|
|
51
|
+
found_version = None
|
|
52
|
+
for version in versions:
|
|
53
|
+
try:
|
|
54
|
+
subprocess.check_output([
|
|
55
|
+
"pkg-config",
|
|
56
|
+
"--exists",
|
|
57
|
+
f"{package}-{version}",
|
|
58
|
+
])
|
|
59
|
+
except subprocess.CalledProcessError:
|
|
60
|
+
continue
|
|
61
|
+
print(f"FOUND {package} version {version}")
|
|
62
|
+
found_version = version
|
|
63
|
+
break
|
|
64
|
+
if found_version:
|
|
65
|
+
return f"{package}-{found_version}"
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def pkg_config(packages, flag, versions=None):
|
|
69
|
+
"""Run pkg-config with given flag"""
|
|
70
|
+
found_packages = []
|
|
71
|
+
# Check if the package exists
|
|
72
|
+
for pkg in packages:
|
|
73
|
+
if found_pkg := find_pkg(pkg, versions):
|
|
74
|
+
found_packages.append(found_pkg)
|
|
75
|
+
try:
|
|
76
|
+
output = (
|
|
77
|
+
subprocess.check_output(["pkg-config", flag] + found_packages)
|
|
78
|
+
.decode("utf-8")
|
|
79
|
+
.strip()
|
|
80
|
+
)
|
|
81
|
+
output_dirs = []
|
|
82
|
+
for output_dir in output.split():
|
|
83
|
+
output_dirs.append(output_dir.split("-I")[-1])
|
|
84
|
+
return output_dirs
|
|
85
|
+
except subprocess.CalledProcessError:
|
|
86
|
+
return []
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# Check that pkg-config is installed
|
|
90
|
+
check_pkg_config()
|
|
91
|
+
|
|
92
|
+
# get vcpkg paths when building wheels
|
|
93
|
+
vcpkg_path = os.environ.get("VCPKG_ROOT")
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def get_vcpkg_includes():
|
|
97
|
+
"""Get include dir for vcpkg"""
|
|
98
|
+
if vcpkg_path:
|
|
99
|
+
python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
|
|
100
|
+
headers_dir = next(
|
|
101
|
+
(s for s in os.listdir("/opt/_internal") if python_version in s), None
|
|
102
|
+
)
|
|
103
|
+
if not headers_dir:
|
|
104
|
+
return [
|
|
105
|
+
f"{vcpkg_path}/installed/x64-linux/include",
|
|
106
|
+
f"{vcpkg_path}/installed/arm64-linux/include",
|
|
107
|
+
]
|
|
108
|
+
return [
|
|
109
|
+
f"{vcpkg_path}/installed/x64-linux/include",
|
|
110
|
+
f"{vcpkg_path}/installed/arm64-linux/include",
|
|
111
|
+
f"/opt/_internal/{headers_dir}/include/python{python_version}",
|
|
112
|
+
]
|
|
113
|
+
else:
|
|
114
|
+
return []
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def get_vcpkg_extra_libs():
|
|
118
|
+
"""Get extra libs explicitly for linking because FCL port for vcpkg
|
|
119
|
+
builds as a static lib that does not link its dependencies
|
|
120
|
+
"""
|
|
121
|
+
if vcpkg_path:
|
|
122
|
+
return ["octomap", "octomath", "ccd"]
|
|
123
|
+
else:
|
|
124
|
+
return []
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# OMPL dependencies
|
|
128
|
+
ompl_include_dirs = pkg_config(["ompl", "eigen3"], flag="--cflags-only-I")
|
|
129
|
+
|
|
130
|
+
# Accepted PCL versions
|
|
131
|
+
pcl_versions = ["1.14", "1.13", "1.12", "1.11", "1.10", "1.9"]
|
|
132
|
+
|
|
133
|
+
# Kompass CPP dependencies
|
|
134
|
+
eigen_include_dir = pkg_config(["eigen3"], flag="--cflags-only-I")
|
|
135
|
+
pcl_include_dir = pkg_config(
|
|
136
|
+
["pcl_common"], flag="--cflags-only-I", versions=pcl_versions
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
# vcpkg paths when running in CI
|
|
140
|
+
vcpkg_includes_dir = get_vcpkg_includes()
|
|
141
|
+
vcpkg_extra_libs = get_vcpkg_extra_libs()
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
## Check include dirs
|
|
145
|
+
|
|
146
|
+
# for OMPL
|
|
147
|
+
ompl_module_includes = ompl_include_dirs + vcpkg_includes_dir
|
|
148
|
+
# try a static path when pkg_config does not return anything and not in CI
|
|
149
|
+
if not ompl_module_includes:
|
|
150
|
+
ompl_module_includes = [OMPL_INCLUDE_DEFAULT_DIR, EIGEN_INCLUDE_DEFAULT_DIR]
|
|
151
|
+
|
|
152
|
+
# for Kompass CPP
|
|
153
|
+
kompass_cpp_dependency_includes = (
|
|
154
|
+
eigen_include_dir + pcl_include_dir + vcpkg_includes_dir
|
|
155
|
+
)
|
|
156
|
+
kompass_cpp_module_includes = [
|
|
157
|
+
"src/kompass_cpp/kompass_cpp/include"
|
|
158
|
+
] + kompass_cpp_dependency_includes
|
|
159
|
+
# try a static path when pkg_config does not return anything and not in CI
|
|
160
|
+
kompass_cpp_module_includes = (
|
|
161
|
+
[
|
|
162
|
+
"src/kompass_cpp/kompass_cpp/include",
|
|
163
|
+
EIGEN_INCLUDE_DEFAULT_DIR,
|
|
164
|
+
PCL_INCLUDE_DEFAULT_DIR,
|
|
165
|
+
]
|
|
166
|
+
if not kompass_cpp_dependency_includes
|
|
167
|
+
else ["src/kompass_cpp/kompass_cpp/include"] + kompass_cpp_dependency_includes
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
ext_modules = [
|
|
172
|
+
Pybind11Extension(
|
|
173
|
+
"ompl",
|
|
174
|
+
glob.glob(os.path.join("src/ompl/src", "*.cpp")),
|
|
175
|
+
include_dirs=ompl_module_includes,
|
|
176
|
+
libraries=["ompl"],
|
|
177
|
+
library_dirs=get_libraries_dir(),
|
|
178
|
+
define_macros=[("VERSION_INFO", __version__)],
|
|
179
|
+
),
|
|
180
|
+
Pybind11Extension(
|
|
181
|
+
"kompass_cpp",
|
|
182
|
+
glob.glob(
|
|
183
|
+
os.path.join("src/kompass_cpp/kompass_cpp/src/**", "*.cpp"), recursive=True
|
|
184
|
+
),
|
|
185
|
+
include_dirs=kompass_cpp_module_includes,
|
|
186
|
+
libraries=["fcl", "pcl_io_ply", "pcl_common"] + vcpkg_extra_libs,
|
|
187
|
+
library_dirs=get_libraries_dir(),
|
|
188
|
+
define_macros=[("VERSION_INFO", __version__)],
|
|
189
|
+
),
|
|
190
|
+
]
|
|
191
|
+
|
|
192
|
+
# add parallel compilation if flag is set
|
|
193
|
+
ParallelCompile("CMAKE_BUILD_PARALLEL_LEVEL", needs_recompile=naive_recompile).install()
|
|
194
|
+
|
|
195
|
+
setup(
|
|
196
|
+
packages=find_packages(where="src"),
|
|
197
|
+
ext_modules=ext_modules,
|
|
198
|
+
cmdclass={"build_ext": build_ext},
|
|
199
|
+
zip_safe=False,
|
|
200
|
+
)
|
|
File without changes
|