Skip to content

Commit

Permalink
Update artificial_potential.py
Browse files Browse the repository at this point in the history
  • Loading branch information
snktshrma authored Jun 26, 2024
1 parent 19df5a3 commit b149d69
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions artificial_potential.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# /usr/bin/python
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
Expand All @@ -13,13 +12,13 @@

def attractive_force(position, goal):
"""
Calculate the attractive force towards the goal.
Calculate the attractive force towards the goal
"""
return -k_att * (position - goal)

def repulsive_force(position, obstacles, d0, k_rep):
"""
Calculate the repulsive force from obstacles.
Calculate the repulsive force from obstacles
"""
force = np.zeros(2)
for obs in obstacles:
Expand Down Expand Up @@ -104,4 +103,4 @@ def update(frame):
ax.set_title('Dynamic Potential Field')
ax.grid()

plt.show()
plt.show()

0 comments on commit b149d69

Please sign in to comment.