Modern_Robotics/packages/Python/README.md

1.8 KiB

"modern_robotics" Python Package Instructions

Dependency Requirement

numpy should be preinstalled.

Installing the Package

Use pip to install by running

pip install modern_robotics

If pip is not preinstalled, check here for help installing pip.

Alternative Method

Download the package and run python setup.py build and python setup.py install in the package directory

Importing the Package

To import the package, we recommend using

import modern_robotics as mr

This process is required for any Python program using this package.

Using the Package

After importing the package, you should be able to use any function in the package. Taking the function RotInv for example, you can check the description and usage example of this function by running

help(mr.RotInv)

As mentioned in the function usage example, you can try using this function by running

R = np.array([[0, 0, 1],
              [1, 0, 0],
              [0, 1, 0]])
invR = mr.RotInv(R)

You should get the variable invR whose value is the same as the output shown in the function usage example.

Your complete first test code that will return invR could be as follows:

import modern_robotics as mr
import numpy as np
R = np.array([[0, 0, 1],
              [1, 0, 0],
              [0, 1, 0]])
invR = mr.RotInv(R)
print(invR)

Using the Package Locally

It is possible to use the package locally without installation. Download and place the package in the working directory. Note that since the package is not installed, you need to move the package if the working directory is changed. Importing is still required before using.