Skip to content

rtbtool

Peter Corke edited this page Feb 28, 2021 · 2 revisions

rtbtool is a command line tool that drops you into an Python environment with some toolboxes already loaded

____ ____ ___  ____ ___ _ ____ ____    ___ ____ ____ _    ___  ____ _  _
|__/ |  | |__] |  |  |  | |    [__      |  |  | |  | |    |__] |  |  \/
|  \ |__| |__] |__|  |  | |___ ___]     |  |__| |__| |___ |__] |__| _/\_

for Python

from roboticstoolbox import *
from spatialmath import *

func/object?       - show brief help
help(func/object)  - show detailed help
func/object??      - show source code


Python 3.8.5 (default, Sep  4 2020, 02:22:02) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.
>>>

The import * means that you don't need to use a package prefix. Two robot models are also already imported: puma and 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)

Command line options

positional arguments:
  script                specify script to run

optional arguments:
  -h, --help            show this help message and exit
  --backend BACKEND, -b BACKEND
                        specify graphics backend
  --color COLOR, -c COLOR
                        specify terminal color scheme (neutral, lightbg, nocolor, linux), linux is for dark mode
  --confirmexit CONFIRMEXIT, -x CONFIRMEXIT
                        confirm exit
  --prompt PROMPT, -p PROMPT
                        input prompt
  --resultprefix RESULTPREFIX, -r RESULTPREFIX
                        execution result prefix, include {} for execution count number
  --noshowassign, -a    do not display the result of assignments

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, when ordinarily it is not and you would 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        ┃
    ┗                                           ┛