Modify some READMEs

This commit is contained in:
HuanWeng 2018-07-30 13:40:46 -05:00
parent cd2b965069
commit 484dcedbea
7 changed files with 89 additions and 41 deletions

View File

@ -1,13 +1,14 @@
# Mathematica Front-End Installation Instructions # # Mathematica Front-End Installation Instructions #
If you'd like to be able to use this package inside of any notebook, regardless If you'd like to be able to use this package inside of any notebook,
of the notebook's location on your filesystem, then you can use Mathematica's regardless of the notebook's location on your filesystem, then you can use
front end to install this package. Use the following steps: Mathematica's front end to install this package. Use the following steps:
1. Click `File -> Install...` 1. Click `File -> Install...`
2. Select `Package` for the _Type of Item to Install_ 2. Select `Package` for the _Type of Item to Install_
3. Chose `From File...` for the _Source_ 3. Chose `From File...` for the _Source_
4. Navigate to the `ModernRobotics.m` and select it as the source for the package 4. Navigate to the `ModernRobotics.m` and select it as the source for the
package
5. The _Install Name_ should default to `ModernRobotics`; if it doesn't then 5. The _Install Name_ should default to `ModernRobotics`; if it doesn't then
fill in the install name to be `ModernRobotics`. fill in the install name to be `ModernRobotics`.
6. Choose whether you want the package installed for a single user or for all 6. Choose whether you want the package installed for a single user or for all
@ -39,8 +40,8 @@ common operating systems:
## Manual Installation Instructions ## ## Manual Installation Instructions ##
If you have any troubles with the front-end installation described above, you If you have any troubles with the front-end installation described above, you
can try manually installing the package by copying the `ModernRobotics.m` file can try manually installing the package by copying the `ModernRobotics.m`
into the same directory mentioned for uninstalling. file into the same directory mentioned for uninstalling.
# Using the Package Locally # # Using the Package Locally #
@ -53,7 +54,8 @@ SetDirectory["<PATH-TO-DIRECTORY-CONTAINING-ModernRobotics.m>"]
<<ModernRobotics` <<ModernRobotics`
``` ```
If the notebook and the package are located in the same directory you could use If the notebook and the package are located in the same directory you could
use
``` ```
SetDirectory[NotebookDirectory[]] SetDirectory[NotebookDirectory[]]

34
packages/Matlab/README.md Normal file
View File

@ -0,0 +1,34 @@
# "mr" Matlab Package Instructions #
This package is the code library for _Modern Robotics: Mechanics, Planning,
and Control_. For more details please see the library introduction pdf file
or the [website](http://modernrobotics.org/).
To import the package, use `addpath` as
```
addpath('$FOLDER_PATH/mr')
```
where `$FOLDER_PATH` is the path to "mr" directory.
To check the function list and which chapter in the book do those functions
belong to, use `help` as
```
help mr
```
To check more introduction and example of a function, use `help` as
```
help $FUNCTION_NAME
```
## ##
Author: Huan Weng, Bill Hunt, Mikhail Todes, Jarvis Schultz
Contact: huanweng@u.northwestern.edu
Package Version: 1.0.0
Matlab Version: R2017b
Tested in Matlab R2017b

View File

@ -1,4 +1,5 @@
function [thetalist, success] ... function [thetalist, success] ...
= IKinSpace(Slist, M, T, thetalist0, eomg, ev)
% *** CHAPTER 6: INVERSE KINEMATICS *** % *** CHAPTER 6: INVERSE KINEMATICS ***
% Takes Slist: The joint screw axes in the space frame when the manipulator % Takes Slist: The joint screw axes in the space frame when the manipulator
% is at the home position, in the format of a matrix with the % is at the home position, in the format of a matrix with the

View File

@ -0,0 +1,5 @@
# "modern_robotics" Python Package Instructions #
This package is the code library for _Modern Robotics: Mechanics, Planning,
and Control_. For more details please see the library introduction pdf file
or the [website](http://modernrobotics.org/).

View File

@ -1,4 +1,4 @@
from __version__ import __version__ from .__version__ import __version__
from core import * from .core import *

View File

@ -1,3 +1,4 @@
from __future__ import print_function
''' '''
*************************************************************************** ***************************************************************************
Modern Robotics: Mechanics, Planning, and Control. Modern Robotics: Mechanics, Planning, and Control.
@ -19,7 +20,6 @@ Optional library: matplotlib
''' '''
import numpy as np import numpy as np
import matplotlib.pyplot as plt
''' '''
*** BASIC HELPER FUNCTIONS *** *** BASIC HELPER FUNCTIONS ***
@ -658,7 +658,7 @@ def JacobianBody(Blist, thetalist):
[-1.44321167, 2.94561275, 1.43306521, 0.3] [-1.44321167, 2.94561275, 1.43306521, 0.3]
[-2.06639565, 1.82881722, -1.58868628, 0.4]]) [-2.06639565, 1.82881722, -1.58868628, 0.4]])
""" """
Jb = np.array(Blist).copy() Jb = np.array(Blist).copy().astype(np.float)
T = np.eye(4) T = np.eye(4)
for i in range(len(thetalist) - 2, -1, -1): for i in range(len(thetalist) - 2, -1, -1):
T = np.dot(T,MatrixExp6(VecTose3(np.array(Blist)[:, i + 1] \ T = np.dot(T,MatrixExp6(VecTose3(np.array(Blist)[:, i + 1] \
@ -690,7 +690,7 @@ def JacobianSpace(Slist, thetalist):
[0.2, 0.43654132, -2.43712573, 2.77535713] [0.2, 0.43654132, -2.43712573, 2.77535713]
[0.2, 2.96026613, 3.23573065, 2.22512443]]) [0.2, 2.96026613, 3.23573065, 2.22512443]])
""" """
Js = np.array(Slist).copy() Js = np.array(Slist).copy().astype(np.float)
T = np.eye(4) T = np.eye(4)
for i in range(1, len(thetalist)): for i in range(1, len(thetalist)):
T = np.dot(T, MatrixExp6(VecTose3(np.array(Slist)[:, i - 1] \ T = np.dot(T, MatrixExp6(VecTose3(np.array(Slist)[:, i - 1] \
@ -1305,7 +1305,7 @@ def InverseDynamicsTrajectory(thetamat, dthetamat, ddthetamat, g, \
try: try:
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
except: except:
print 'The result will not be plotted due to a lack of package matplotlib' print('The result will not be plotted due to a lack of package matplotlib')
else: else:
plt.plot(timestamp, Tau1, label = "Tau1") plt.plot(timestamp, Tau1, label = "Tau1")
plt.plot(timestamp, Tau2, label = "Tau2") plt.plot(timestamp, Tau2, label = "Tau2")
@ -1409,11 +1409,11 @@ def ForwardDynamicsTrajectory(thetalist, dthetalist, taumat, g, Ftipmat, \
dtheta3 = dthetamat[:, 2] dtheta3 = dthetamat[:, 2]
N = np.array(taumat).shape[0] N = np.array(taumat).shape[0]
Tf = np.array(taumat).shape[0] * dt Tf = np.array(taumat).shape[0] * dt
timestamp = np.linspace(0, Tf, N) timestamp = np.linspace(0, Tf, N)
try: try:
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
except: except:
print 'The result will not be plotted due to a lack of package matplotlib' print(The result will not be plotted due to a lack of package matplotlib)
else: else:
plt.plot(timestamp, theta1, label = "Theta1") plt.plot(timestamp, theta1, label = "Theta1")
plt.plot(timestamp, theta2, label = "Theta2") plt.plot(timestamp, theta2, label = "Theta2")
@ -1430,9 +1430,9 @@ def ForwardDynamicsTrajectory(thetalist, dthetalist, taumat, g, Ftipmat, \
""" """
taumat = np.array(taumat).T taumat = np.array(taumat).T
Ftipmat = np.array(Ftipmat).T Ftipmat = np.array(Ftipmat).T
thetamat = taumat.copy() thetamat = taumat.copy().astype(np.float)
thetamat[:, 0] = thetalist thetamat[:, 0] = thetalist
dthetamat = taumat.copy() dthetamat = taumat.copy().astype(np.float)
dthetamat[:, 0] = dthetalist dthetamat[:, 0] = dthetalist
for i in range(np.array(taumat).shape[1] - 1): for i in range(np.array(taumat).shape[1] - 1):
for j in range(intRes): for j in range(intRes):
@ -1798,7 +1798,7 @@ def SimulateControl(thetalist, dthetalist, g, Ftipmat, Mlist, Glist, \
#Create a trajectory to follow #Create a trajectory to follow
thetaend = np.array([np.pi / 2, np.pi, 1.5 * np.pi]) thetaend = np.array([np.pi / 2, np.pi, 1.5 * np.pi])
Tf = 1 Tf = 1
N = 1.0 * Tf / dt N = int(1.0 * Tf / dt)
method = 5 method = 5
traj = mr.JointTrajectory(thetalist, thetaend, Tf, N, method) traj = mr.JointTrajectory(thetalist, thetaend, Tf, N, method)
thetamatd = np.array(traj).copy() thetamatd = np.array(traj).copy()
@ -1871,26 +1871,26 @@ def SimulateControl(thetalist, dthetalist, g, Ftipmat, Mlist, Glist, \
eint = np.add(eint, dt * np.subtract(thetamatd[:, i], thetacurrent)) eint = np.add(eint, dt * np.subtract(thetamatd[:, i], thetacurrent))
#Output using matplotlib to plot #Output using matplotlib to plot
try: try:
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
except: except:
print 'The result will not be plotted due to a lack of package matplotlib' print('The result will not be plotted due to a lack of package matplotlib')
else: else:
links = np.array(thetamat).shape[0] links = np.array(thetamat).shape[0]
N = np.array(thetamat).shape[1] N = np.array(thetamat).shape[1]
Tf = N * dt Tf = N * dt
timestamp = np.linspace(0, Tf, N) timestamp = np.linspace(0, Tf, N)
for i in range(links): for i in range(links):
col = [np.random.uniform(0, 1), np.random.uniform(0, 1), col = [np.random.uniform(0, 1), np.random.uniform(0, 1),
np.random.uniform(0, 1)] np.random.uniform(0, 1)]
plt.plot(timestamp, thetamat[i, :], "-", color=col, \ plt.plot(timestamp, thetamat[i, :], "-", color=col, \
label = ("ActualTheta" + str(i + 1))) label = ("ActualTheta" + str(i + 1)))
plt.plot(timestamp, thetamatd[i, :], ".", color=col, \ plt.plot(timestamp, thetamatd[i, :], ".", color=col, \
label = ("DesiredTheta" + str(i + 1))) label = ("DesiredTheta" + str(i + 1)))
plt.legend(loc = 'upper left') plt.legend(loc = 'upper left')
plt.xlabel("Time") plt.xlabel("Time")
plt.ylabel("Joint Angles") plt.ylabel("Joint Angles")
plt.title("Plot of Actual and Desired Joint Angles") plt.title("Plot of Actual and Desired Joint Angles")
plt.show() plt.show()
taumat = np.array(taumat).T taumat = np.array(taumat).T
thetamat = np.array(thetamat).T thetamat = np.array(thetamat).T
return (taumat, thetamat) return (taumat, thetamat)

View File

@ -12,11 +12,17 @@ setup(
packages=['modern_robotics'], packages=['modern_robotics'],
classifiers=[ classifiers=[
"Development Status :: 3 - Alpha", "Development Status :: 3 - Alpha",
"Topic :: Utilities", "Intended Audience :: Education",
"License :: OSI Approved :: BSD License", "Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Topic :: Education",
"Topic :: Scientific/Engineering",
], ],
install_requires=[ install_requires=[
'numpy' 'numpy',
], ],
platforms='Linux, Mac, Windows', platforms='Linux, Mac, Windows',
) )