cbfpy 0.0.1__py3-none-any.whl → 0.0.4__py3-none-any.whl
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.
- cbfpy/cbfs/cbf.py +46 -70
- cbfpy/cbfs/clf_cbf.py +81 -86
- cbfpy/config/cbf_config.py +106 -56
- cbfpy/config/clf_cbf_config.py +79 -29
- cbfpy/envs/base_env.py +3 -3
- cbfpy/envs/drone_env.py +1 -1
- cbfpy/examples/adaptive_cruise_control_demo.py +5 -4
- cbfpy/examples/drone_demo.py +8 -6
- cbfpy/examples/joint_limits_demo.py +1 -1
- cbfpy/examples/point_robot_obstacle_demo.py +7 -7
- {cbfpy-0.0.1.dist-info → cbfpy-0.0.4.dist-info}/METADATA +24 -17
- cbfpy-0.0.4.dist-info/RECORD +32 -0
- {cbfpy-0.0.1.dist-info → cbfpy-0.0.4.dist-info}/WHEEL +1 -1
- test/test_speed.py +2 -2
- cbfpy/temp/test_import.py +0 -3
- cbfpy-0.0.1.dist-info/RECORD +0 -33
- {cbfpy-0.0.1.dist-info → cbfpy-0.0.4.dist-info/licenses}/LICENSE +0 -0
- {cbfpy-0.0.1.dist-info → cbfpy-0.0.4.dist-info}/top_level.txt +0 -0
|
@@ -6,7 +6,7 @@ within the limits (+ some margin)
|
|
|
6
6
|
|
|
7
7
|
This uses a single-integrator reduced model of the manipulator dynamics.
|
|
8
8
|
We define the state as the joint positions and assume that we can directly control the joint velocities
|
|
9
|
-
i.e. z = [q1, q2, q3] and u = [q1_dot, q2_dot, q3_dot]
|
|
9
|
+
i.e. z = [q1, q2, q3] and u = [q1_dot, q2_dot, q3_dot]
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
import numpy as np
|
|
@@ -9,8 +9,8 @@ This demo is interactive: click and drag the obstacle to move it around.
|
|
|
9
9
|
Here, we have double integrator dynamics: z = [position, velocity], u = [acceleration]
|
|
10
10
|
and we also use the state of the obstacle as an input to the CBF: z_obs = [position, velocity]
|
|
11
11
|
|
|
12
|
-
This example includes both relative-degree-1 and relative-degree-2 CBFs. Staying inside the safe-set box is
|
|
13
|
-
RD2, since we have a positional barrier with acceleration inputs. Avoiding the obstacle is relative-degree-1,
|
|
12
|
+
This example includes both relative-degree-1 and relative-degree-2 CBFs. Staying inside the safe-set box is
|
|
13
|
+
RD2, since we have a positional barrier with acceleration inputs. Avoiding the obstacle is relative-degree-1,
|
|
14
14
|
because this is based on the relative velocity between the two objects.
|
|
15
15
|
"""
|
|
16
16
|
|
|
@@ -38,17 +38,17 @@ class PointRobotObstacleConfig(CBFConfig):
|
|
|
38
38
|
init_args=(init_z_obs,),
|
|
39
39
|
)
|
|
40
40
|
|
|
41
|
-
def f(self, z):
|
|
41
|
+
def f(self, z, *args, **kwargs):
|
|
42
42
|
A = jnp.block(
|
|
43
43
|
[[jnp.zeros((3, 3)), jnp.eye(3)], [jnp.zeros((3, 3)), jnp.zeros((3, 3))]]
|
|
44
44
|
)
|
|
45
45
|
return A @ z
|
|
46
46
|
|
|
47
|
-
def g(self, z):
|
|
47
|
+
def g(self, z, *args, **kwargs):
|
|
48
48
|
B = jnp.block([[jnp.zeros((3, 3))], [jnp.eye(3) / self.mass]])
|
|
49
49
|
return B
|
|
50
50
|
|
|
51
|
-
def h_1(self, z, z_obs):
|
|
51
|
+
def h_1(self, z, z_obs, **kwargs):
|
|
52
52
|
# Distance between >= obstacle radius + robot radius + deceleration distance
|
|
53
53
|
pos_robot = z[:3]
|
|
54
54
|
vel_robot = z[3:]
|
|
@@ -69,13 +69,13 @@ class PointRobotObstacleConfig(CBFConfig):
|
|
|
69
69
|
]
|
|
70
70
|
)
|
|
71
71
|
|
|
72
|
-
def h_2(self, z, z_obs):
|
|
72
|
+
def h_2(self, z, z_obs, **kwargs):
|
|
73
73
|
# Stay inside the safe set (a box)
|
|
74
74
|
pos_max = jnp.array([1.0, 1.0, 1.0])
|
|
75
75
|
pos_min = jnp.array([-1.0, -1.0, -1.0])
|
|
76
76
|
return jnp.concatenate([pos_max - z[:3], z[:3] - pos_min])
|
|
77
77
|
|
|
78
|
-
def alpha(self, h):
|
|
78
|
+
def alpha(self, h, *args, **kwargs):
|
|
79
79
|
return 3 * h
|
|
80
80
|
|
|
81
81
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: cbfpy
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Control Barrier Functions in Python
|
|
5
5
|
Author-email: Daniel Morton <danielpmorton@gmail.com>
|
|
6
6
|
Project-URL: Documentation, https://danielpmorton.github.io/cbfpy/
|
|
@@ -8,15 +8,14 @@ Project-URL: Repository, https://github.com/danielpmorton/cbfpy/
|
|
|
8
8
|
Keywords: control,barrier,function,CBF,Jax
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
11
|
Description-Content-Type: text/markdown
|
|
13
12
|
License-File: LICENSE
|
|
14
|
-
Requires-Dist: numpy
|
|
13
|
+
Requires-Dist: numpy
|
|
15
14
|
Requires-Dist: jax
|
|
16
15
|
Requires-Dist: jaxlib
|
|
17
16
|
Requires-Dist: qpax
|
|
18
17
|
Provides-Extra: examples
|
|
19
|
-
Requires-Dist: pybullet; extra == "examples"
|
|
18
|
+
Requires-Dist: pybullet>=3.2.7; extra == "examples"
|
|
20
19
|
Requires-Dist: pygame; extra == "examples"
|
|
21
20
|
Requires-Dist: wheel; extra == "examples"
|
|
22
21
|
Requires-Dist: matplotlib; extra == "examples"
|
|
@@ -26,12 +25,19 @@ Requires-Dist: mkdocstrings[python]; extra == "dev"
|
|
|
26
25
|
Requires-Dist: pylint; extra == "dev"
|
|
27
26
|
Requires-Dist: black; extra == "dev"
|
|
28
27
|
Provides-Extra: all
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist: black; extra == "all"
|
|
31
|
-
Requires-Dist: pybullet; extra == "all"
|
|
28
|
+
Requires-Dist: pybullet>=3.2.7; extra == "all"
|
|
32
29
|
Requires-Dist: pygame; extra == "all"
|
|
30
|
+
Requires-Dist: wheel; extra == "all"
|
|
31
|
+
Requires-Dist: matplotlib; extra == "all"
|
|
33
32
|
Requires-Dist: mkdocs-material; extra == "all"
|
|
34
33
|
Requires-Dist: mkdocstrings[python]; extra == "all"
|
|
34
|
+
Requires-Dist: pylint; extra == "all"
|
|
35
|
+
Requires-Dist: black; extra == "all"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
<div align="center">
|
|
39
|
+
<img src="https://github.com/user-attachments/assets/0304752c-cb75-4d53-b45f-b6b1a0912d9c" alt="logo"></img>
|
|
40
|
+
</div>
|
|
35
41
|
|
|
36
42
|
# CBFpy: Control Barrier Functions in Python and Jax
|
|
37
43
|
|
|
@@ -43,20 +49,21 @@ CBFpy is an easy-to-use and high-performance framework for constructing and solv
|
|
|
43
49
|
|
|
44
50
|
For API reference, see the following [documentation](https://danielpmorton.github.io/cbfpy)
|
|
45
51
|
|
|
46
|
-
If you use CBFpy in your research, please
|
|
52
|
+
If you use CBFpy in your research, please cite the following [paper](https://arxiv.org/abs/2503.06736):
|
|
47
53
|
|
|
48
54
|
```
|
|
49
|
-
@
|
|
50
|
-
author
|
|
51
|
-
|
|
52
|
-
title
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
year = {2024}
|
|
55
|
+
@inproceedings{morton2025oscbf,
|
|
56
|
+
author={Morton, Daniel and Pavone, Marco},
|
|
57
|
+
booktitle={2025 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)},
|
|
58
|
+
title={Safe, Task-Consistent Manipulation with Operational Space Control Barrier Functions},
|
|
59
|
+
year={2025},
|
|
60
|
+
pages={187-194},
|
|
61
|
+
doi={10.1109/IROS60139.2025.11246389}
|
|
57
62
|
}
|
|
58
63
|
```
|
|
59
64
|
|
|
65
|
+
[](https://arxiv.org/abs/2503.06736)
|
|
66
|
+
|
|
60
67
|
## Installation
|
|
61
68
|
|
|
62
69
|
### From PyPI
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
cbfpy/__init__.py,sha256=Fq5snpGxff_id-Qlpl1f52OZWr9WrVaEpZhmWE9fRpI,366
|
|
2
|
+
cbfpy/cbfs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
cbfpy/cbfs/cbf.py,sha256=MhdnVNk37vmIiMF1_cZoV9zBUOXUHqn4L4DmPlkO9lY,12831
|
|
4
|
+
cbfpy/cbfs/clf_cbf.py,sha256=T5SWaE8kdK-i9C7PxtevytCkai3Pu8AisNa8X8rEP38,17193
|
|
5
|
+
cbfpy/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
cbfpy/config/cbf_config.py,sha256=Q4hzvBkxmGVTJsS5E2jDkhpcUbGaC5wlddlpjHPnnHo,19076
|
|
7
|
+
cbfpy/config/clf_cbf_config.py,sha256=srMa-MlTRsvpuQTZTOPAV9nBebIFBUwqkQYE3DbdtgA,13375
|
|
8
|
+
cbfpy/envs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
cbfpy/envs/arm_envs.py,sha256=mY5A3nId0CbhpwbXrXx34T_Tce0QJzj3fiaJ2YAw4K8,2785
|
|
10
|
+
cbfpy/envs/base_env.py,sha256=eaoUrGnKAb08v9Fouwu9vR5sjQYcSFO7rKHpSuL71_U,1815
|
|
11
|
+
cbfpy/envs/car_env.py,sha256=u8-m3Mpp49FJclxARI63IDmZmKSz6zCFnxxwg1Q3CVo,11245
|
|
12
|
+
cbfpy/envs/drone_env.py,sha256=tX6TLiYvweOvcWu4KIVjdJw4SPyQqwC6rsJR9NO1dp0,5761
|
|
13
|
+
cbfpy/envs/point_robot_envs.py,sha256=p_UK_uwUWLyDdwvsFgVRWEI1Ngw1WqgadkMb8yjuj8Q,7877
|
|
14
|
+
cbfpy/examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
+
cbfpy/examples/adaptive_cruise_control_demo.py,sha256=Hr64pf_opkzRh-i2Xdo8ahbeG5Wbn-cSgBb7HK3QrhU,4209
|
|
16
|
+
cbfpy/examples/drone_demo.py,sha256=7hS3Ux7LsGVpIYg7kmfoeXs_goUh_0E8VG73he5ktjI,3672
|
|
17
|
+
cbfpy/examples/joint_limits_demo.py,sha256=erDsImVJ-VOshlmauTk6x4cZWqfdG2M5Y0HY9C_V-6w,4533
|
|
18
|
+
cbfpy/examples/point_robot_demo.py,sha256=rLHI32H76Sk-w4CTvuIo8YjgBLFZi7NLZILaGEciG9Y,2868
|
|
19
|
+
cbfpy/examples/point_robot_obstacle_demo.py,sha256=QpOpZ5GRgWfRgAoKfuiPPgfsz2zdVEtmp9SKiDYHoAQ,3844
|
|
20
|
+
cbfpy/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
+
cbfpy/utils/general_utils.py,sha256=TV8pk7Miysu0H3HLe9L0MrEZLMTxOIykW_h4cIrts-o,4157
|
|
22
|
+
cbfpy/utils/jax_utils.py,sha256=87zT1_6OlaSw2HCdTfC-rqP8gchtUleSH6v_QlwzkYA,596
|
|
23
|
+
cbfpy/utils/math_utils.py,sha256=69Wb6kAuAAG38_eW39QrZHNDYYv--5hBS8RJOFsJ0BE,637
|
|
24
|
+
cbfpy/utils/visualization.py,sha256=d4bdZCEl9AUjRz-D_uNpCu4bSUkz_wOBBaTaAH9D7go,3319
|
|
25
|
+
cbfpy-0.0.4.dist-info/licenses/LICENSE,sha256=VsRPtVDiLQq5oEH67g9hLJNScJhe6URhGIkCcfLjGAA,1070
|
|
26
|
+
test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
|
+
test/test_speed.py,sha256=Trurpgin3F24XJAJNEpSvPjLjeGSKe4Jdi3uTLpRO-I,7334
|
|
28
|
+
test/test_utils.py,sha256=vf9NOPLxY9EnQStzAGhctQ21DBoggbFdMOpzbDg1o8E,829
|
|
29
|
+
cbfpy-0.0.4.dist-info/METADATA,sha256=mA08rCukDXC9VaejBGczylIZR63_jE_rWfF9niudNhI,9322
|
|
30
|
+
cbfpy-0.0.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
31
|
+
cbfpy-0.0.4.dist-info/top_level.txt,sha256=zf3vvm0IroFA5aatt-r1KWBtjBg-FeAh_e2ut4fLsjk,11
|
|
32
|
+
cbfpy-0.0.4.dist-info/RECORD,,
|
test/test_speed.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"""Speed tests for the CBF solver
|
|
2
2
|
|
|
3
3
|
We evaluate the speed of the solver NOT just via the QP solve but via the whole process
|
|
4
|
-
(solving for the nominal control input, constructing the QP matrices, and then solving).
|
|
4
|
+
(solving for the nominal control input, constructing the QP matrices, and then solving).
|
|
5
5
|
This provides a more accurate view of what the controller frequency would actually be if
|
|
6
6
|
deployed on the robot.
|
|
7
7
|
|
|
8
|
-
These test cases can also be used to check that modifications to the CBF implementation
|
|
8
|
+
These test cases can also be used to check that modifications to the CBF implementation
|
|
9
9
|
do not significantly degrade performance
|
|
10
10
|
"""
|
|
11
11
|
|
cbfpy/temp/test_import.py
DELETED
cbfpy-0.0.1.dist-info/RECORD
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
cbfpy/__init__.py,sha256=Fq5snpGxff_id-Qlpl1f52OZWr9WrVaEpZhmWE9fRpI,366
|
|
2
|
-
cbfpy/cbfs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
cbfpy/cbfs/cbf.py,sha256=WDNAMFjWJq2gaa8rceg8nsimnb2o3CvAOgf_wCCmr-Q,13923
|
|
4
|
-
cbfpy/cbfs/clf_cbf.py,sha256=o8wyKRhj3h4xqMwxnb3wbOyN5O54TYKTWySUhyQYuY4,17492
|
|
5
|
-
cbfpy/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
cbfpy/config/cbf_config.py,sha256=A6HGlf9P3HrG6DeK3qL9pr2zQtaWthbBwm7uN47CQLE,17069
|
|
7
|
-
cbfpy/config/clf_cbf_config.py,sha256=TJVuK5wsESbnVCqm6VNJ5kuaPRpWbQVjyHHALc6KDTs,10703
|
|
8
|
-
cbfpy/envs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
cbfpy/envs/arm_envs.py,sha256=mY5A3nId0CbhpwbXrXx34T_Tce0QJzj3fiaJ2YAw4K8,2785
|
|
10
|
-
cbfpy/envs/base_env.py,sha256=JRS9ASNM0NS5pYUG2wiBcvZSUsa5Buf-ggRzd0Xs9js,1818
|
|
11
|
-
cbfpy/envs/car_env.py,sha256=u8-m3Mpp49FJclxARI63IDmZmKSz6zCFnxxwg1Q3CVo,11245
|
|
12
|
-
cbfpy/envs/drone_env.py,sha256=9PpUFXLjz_vj_eGolkbMDpPTXvyQxF6juGcW3zvDua4,5762
|
|
13
|
-
cbfpy/envs/point_robot_envs.py,sha256=p_UK_uwUWLyDdwvsFgVRWEI1Ngw1WqgadkMb8yjuj8Q,7877
|
|
14
|
-
cbfpy/examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
-
cbfpy/examples/adaptive_cruise_control_demo.py,sha256=QzdYJnUlt5SphE6Foz7wTMnxkk-ojxQ7I1tHVPNQdBg,4147
|
|
16
|
-
cbfpy/examples/drone_demo.py,sha256=FjV9DLeo6CyhwA77XNKxW7LzWZCYULu-XMhG6nYXIes,3590
|
|
17
|
-
cbfpy/examples/joint_limits_demo.py,sha256=imAK7cQ8Uch5b_kFfsmCHy4E7pmlSfZFoEhs8_-rJBw,4534
|
|
18
|
-
cbfpy/examples/point_robot_demo.py,sha256=rLHI32H76Sk-w4CTvuIo8YjgBLFZi7NLZILaGEciG9Y,2868
|
|
19
|
-
cbfpy/examples/point_robot_obstacle_demo.py,sha256=zItuf3L-s9RZvactqo7chZAv0ylTmCTvOPrsHn4V3mk,3775
|
|
20
|
-
cbfpy/temp/test_import.py,sha256=pPeIB0ZtQ-Fb71or2A8LFnSA7fCcpDAYRwocoxdMRIg,25
|
|
21
|
-
cbfpy/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
-
cbfpy/utils/general_utils.py,sha256=TV8pk7Miysu0H3HLe9L0MrEZLMTxOIykW_h4cIrts-o,4157
|
|
23
|
-
cbfpy/utils/jax_utils.py,sha256=87zT1_6OlaSw2HCdTfC-rqP8gchtUleSH6v_QlwzkYA,596
|
|
24
|
-
cbfpy/utils/math_utils.py,sha256=69Wb6kAuAAG38_eW39QrZHNDYYv--5hBS8RJOFsJ0BE,637
|
|
25
|
-
cbfpy/utils/visualization.py,sha256=d4bdZCEl9AUjRz-D_uNpCu4bSUkz_wOBBaTaAH9D7go,3319
|
|
26
|
-
test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
|
-
test/test_speed.py,sha256=hBXNKjO414f3wzHfEIK2ND60dD9AssE9ku_p15YPttE,7336
|
|
28
|
-
test/test_utils.py,sha256=vf9NOPLxY9EnQStzAGhctQ21DBoggbFdMOpzbDg1o8E,829
|
|
29
|
-
cbfpy-0.0.1.dist-info/LICENSE,sha256=VsRPtVDiLQq5oEH67g9hLJNScJhe6URhGIkCcfLjGAA,1070
|
|
30
|
-
cbfpy-0.0.1.dist-info/METADATA,sha256=sA7_vBtcmrNTPKE3WsLXmWoXOSAd2wYuGKkJFzyAT-c,8883
|
|
31
|
-
cbfpy-0.0.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
32
|
-
cbfpy-0.0.1.dist-info/top_level.txt,sha256=zf3vvm0IroFA5aatt-r1KWBtjBg-FeAh_e2ut4fLsjk,11
|
|
33
|
-
cbfpy-0.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|