Neural Potential Field is an Instance of Artificial Potential Field.
Planning in configuration space allows us to consider the robot as a single point, thus simplifying the planning problem.
workspace | configuration space |
---|---|
![]() |
![]() |
path in workspace | path in configuration space |
---|---|
![]() |
![]() |
The simplest form of Artificial Potential Field is the attractive/repulsive potential, and the overall potential function can be constructed as the sum of attractive and repulsive potentials:
where,
However, the conversion from workspace to configuration space usually does not have an explicit mathematical expression, and the configuration space is usually a continuous and high-dimensional space (e.g., a 6-dof robot arm), making it difficult to apply the traditional Artificial Potential Field method in configuration space.
Despite its continuity and high dimensionality, given a configuration, we can easily check if it is in the free configuration space. That means, we can sample from that space, and use finite samples to approximate the entire space. In this repo, whether a robot collides with an obstacle in the environment under configuration
The network in this repo named Collision Detection Network. Indeed, it is a binary classifier trained with Weighted Cross Entropy:
where
- Network Input: Robot Configuration + Variable (e.g. the information on the dimensions (bbox) of the object being grasped by the robot)
- Network output: The probability of collision with the environment
After training the Collision Detection Network, we can visualize its outputs in two ways:
- make configuration fixed, and change the bbox size
configuration in free space | probability in bbox size |
---|---|
![]() |
![]() |
configuration near obstacle | probability in bbox size |
---|---|
![]() |
![]() |
- make bbox size fixed, and change the configuration
ground truth configuration space | network predicted configuration space |
---|---|
![]() |
![]() |
Neural Potential Field replaces the
which is, the negative log-likelihood of the robot not colliding with the environment.
In order to mitigate the effect of local minima on the optimization process, we set up virtual repulsive potentials in the hope that the robot can get rid of the local minima:
and the criteria of detecting local minima is as follows:
The Neural Potential Field Algorithm is as follows:
Path Planned by Neural Potential Field:
different bbox size | w/ & w/o vrep enabled |
---|---|
![]() |
![]() |
Make sure you installed required Python package, e.g., PyTorch, PyQt5 etc.
In src
folder:
python3 generate_data.py --num_train_samples 500000 --num_test_samples 50000 --save_path "../data" --min_bbox_width 10 --max_bbox_width 40 --min_bbox_height 10 --max_bbox_height 40
After running the script, two .npy
files generated for training and testing respectively. BBOX size are sampled from two uniform distribution
In src
folder:
python3 train_collision_detection_network.py --data_folder ../data --log_name collision_detection_network --epochs 100 --gpu_ids 0
In src
folder:
python3 visualize.py --ckpt ../run/collision_detection_network/final.pth --gpu_ids 0
- --ckpt: the checkpoint file of the network
There are two buttons:
- Evaluate Network Output: generate probability in bbox size plot and probability heat map
- Generate Ground Truth Configuration Space: generate the ground truth configuration space using collision detection algorithm provided by PyQt5
In src
folder:
python3 app.py --ckpt ../run/collision_detection_network/final.pth --gpu_ids 0
- --ckpt is the checkpoint file of the network
- --xi: coefficient of the attractive field
- --eta: coefficient of the repulsive field
- --zeta: coefficient of the virtual repulsive field
- --sigma: scope of influence of the virtual repulsive field
- --s: motion to goal step size
- --epsilon: threshold for detecting local minima
- --delta: threshold for detecting convergence
- --N: maximum number of iterations
- --lr: learning rate of SGD optimizer
- --momentum: momentum of the SGD optimizer
mouse double click in the scene to set the goal pose
If you use this repo in your research, please cite this repo:
@misc{Movic2024,
author = {Movic, Chen},
title = {Neural Potential Field},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/mo-vic/NeuralPotentialField}}
}
For commercial use, contact me first: [email protected]
[1] Choset H, Lynch K. M, Hutchinson S, et al. Principles of robot motion: theory, algorithms, and implementations[M]. MIT Press, 2005.