-
-
Notifications
You must be signed in to change notification settings - Fork 621
rtbtool
rtbtool is a command line tool that drops you into an Python environment with some toolboxes already loaded. Requires the tool (or all) extra: pip install roboticstoolbox-python[tool].
____ ____ ___ ____ ___ _ ____ ____ ___ ____ ____ _ ___ ____ _ _
|__/ | | |__] | | | | | [__ | | | | | | |__] | | \/
| \ |__| |__] |__| | | |___ ___] | |__| |__| |___ |__] |__| _/\_
for Python (RTB==<version>, SMTB==<version>, SG==<version>, NumPy==<version>, SciPy==<version>, Matplotlib==<version>)
import math
import numpy as np
from scipy import linalg, optimize
import matplotlib.pyplot as plt
from spatialmath import *
from spatialmath.base import *
from spatialmath.base import sym
from roboticstoolbox import *"
# useful variables
from math import pi
puma = models.DH.Puma560()
panda = models.DH.Panda()
func/object? - show brief help
help(func/object) - show detailed help
func/object?? - show source code
The import * means that you don't need to use a package prefix. Two robot models are also already imported: puma and panda (both DH-parameter models — models.DH.Puma560() and models.DH.Panda())
>>> puma.fkine(puma.qn)
Out[1]:
SE3:┏ ┓
┃ 0 0 1 0.596 ┃
┃ 0 1 0 -0.15 ┃
┃-1 0 0 0.657 ┃
┃ 0 0 0 1 ┃
┗ ┛
>>> puma.plot(puma.qn)
positional arguments:
script specify script to run
options:
-h, --help show this help message and exit
--backend BACKEND, -B BACKEND
specify graphics backend
--theme THEME, -t THEME
specify terminal color theme (neutral, lightbg, nocolor, linux), linux is for dark mode
--confirmexit, -x confirm exit
--prompt PROMPT, -P PROMPT
input prompt
--resultprefix RESULTPREFIX, -R RESULTPREFIX
execution result prefix, include {} for execution count number
--reload enable autoreload of any imported modules, same as IPython's builtin %autoreload 2
--no-banner suppress startup banner
--showassign, -a display the result of assignments
--book use defaults as per RVC book
--ansi use ANSImatrix to display matrices
--examples, -e change working directory to shipped examples
--swift, -s use Swift as default backend
--test non-interactive environment smoke test: print package versions,
exercise one real numeric code path per package, exit 0/1
instead of starting an interactive shell
Options can also be set via the RTB_OPTIONS environment variable, e.g.
export RTB_OPTIONS="--backend TkAgg --prompt 'rtb> ' --reload --showassign".
You can provide a script which runs in the same context, ie. with those packages imported. It is also possible to set the input (--prompt) and result (--resultprefix) prompts.
--showassign/-a means that the result of an assignment
>>> T = SE3()
Out[1]:
SE3:┏ ┓
┃ 1 0 0 0 ┃
┃ 0 1 0 0 ┃
┃ 0 0 1 0 ┃
┃ 0 0 0 1 ┃
┗ ┛
is displayed. Without --showassign (the default) you'd have to write
>>> T = SE3()
>>> T
Out[2]:
SE3:┏ ┓
┃ 1 0 0 0 ┃
┃ 0 1 0 0 ┃
┃ 0 0 1 0 ┃
┃ 0 0 0 1 ┃
┗ ┛
- Frequently asked questions (FAQ)
- Documentation Style Guide
- Background
- Key concepts
- Introduction to robot and link classes
- Working with Jupyter
- Working from the command line
- What about Simulink?
- How to contribute
- Contributors