For XZ plane, you can use this snippet of code:
fig = plt.figure(figsize=(10, 10)) ax = fig.add_subplot(111, projection='3d') for system in systems: plot_system(ax, system) ax.set_proj_type('ortho') ax.view_init(azim=90, elev=0) ax.set_yticklabels([]) ax.set_ylabel('') ax.set_xlim(-0.05, 1.45) ax.set_ylim(-0.75, 0.75) ax.set_zlim(-0.05, 1.45) plt.show()
For side view:
fig = plt.figure(figsize=(10, 10)) ax = fig.add_subplot(111, projection='3d') for system in systems: plot_system(ax, system) ax.view_init(azim=50, elev=20) ax.set_xlim(-0.05, 1.45) ax.set_ylim(-0.75, 0.75) ax.set_zlim(-0.05, 1.45) plt.show()
You will need to implement plot_system()
function and use your own systems
.
Upload a zip archive hw02.zip
(via the course ware) containing:
hw02.json
- json file containing DH parameters of the given manipulator (see below for the description of how to create it).
hw02.pdf
- report file describing your solution containing
Creating hw02.json
:
Create an empty dictionary in Python:
mechanism = {}
The dictionary has 4 keys: “theta offset”
, “d”
, “a”
, “alpha”
. The values are lists of 6 float numbers. Fill in the values with DH parameters of the given manipulator. Consider the distances in meters and angles in radians.
Finally, save mechanism
to hw02.json
:
import json with open("hw02.json", "w") as outfile: json.dump(mechanism, outfile)