Point Robot: Obstacle Avoidance
cbfpy.examples.point_robot_obstacle_demo
Point Robot Obstacle Avoidance Demo
Example of using a CBF + PD controller to control a point robot to reach the origin, while avoiding a moving obstacle and staying in a safe set.
This demo is interactive: click and drag the obstacle to move it around.
Here, we have double integrator dynamics: z = [position, velocity], u = [acceleration] and we also use the state of the obstacle as an input to the CBF: z_obs = [position, velocity]
This example includes both relative-degree-1 and relative-degree-2 CBFs. Staying inside the safe-set box is RD2, since we have a positional barrier with acceleration inputs. Avoiding the obstacle is relative-degree-1, because this is based on the relative velocity between the two objects.
PointRobotObstacleConfig
Bases: CBFConfig
Configuration for the 3D 'point-robot-avoiding-an-obstacle' example.
Source code in cbfpy/examples/point_robot_obstacle_demo.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
nominal_controller(z, z_des)
A simple PD controller for the point robot.
This is unsafe without the CBF, as there is no guarantee that the robot wil not collide with the obstacle
Parameters:
Name | Type | Description | Default |
---|---|---|---|
z |
ArrayLike
|
The current state of the robot [x, y, z, vx, vy, vz] |
required |
z_des |
ArrayLike
|
The desired state of the robot [x_des, y_des, z_des, vx_des, vy_des, vz_des] |
required |
Source code in cbfpy/examples/point_robot_obstacle_demo.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|