Randomized robot

A simple example program for force polytope evaluation of a randomised robot model. Simply change the number of dof torque limits and see how the calculation time and shape evaluates.

πŸ“’ NEW Examples!

For some more examples check out the examples folder of the repository.
  • Interactive jupyter notebooks are available in the examples/notebooks folder: see on Github

import pycapacity.robot as capacity # robot capacity module
import numpy as np

m = 3 # 3d forces
n = 6 # robot dof 

#Β this seed is used to generate the same image 
# as in the examples in the docs 
np.random.seed(12345)

J = np.array(np.random.rand(m,n)) # random jacobian matrix

t_max = np.ones(n)  # joint torque limits max and min
t_min = -np.ones(n)

f_poly = capacity.force_polytope(J,t_min, t_max) # calculate the polytope

print(f_poly.vertices) # display the vertices

# plotting the polytope
import matplotlib.pyplot as plt
from pycapacity.visual import * # pycapacity visualisation tools
fig = plt.figure(4)

# draw faces and vertices
plot_polytope(plot=plt, 
              polytope=f_poly, 
              label='force', 
              edge_color='black', 
              alpha = 0.4)

plt.legend()
plt.show()

../_images/rand_rob_matplotlib.png