Skip to content

Commit f26f883

Browse files
committed
Robotics Toolbox "shell"
1 parent 97001ae commit f26f883

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

examples/rtb.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env python3 -i
2+
3+
# a simple Robotics Toolbox "shell", runs Python3 and loads in NumPy, RTB, SMTB
4+
#
5+
# Run it from the shell
6+
# % rtb.py
7+
#
8+
# or setup an alias
9+
#
10+
# alias rtb=PATH/rtb.py # sh/bash
11+
# alias rtb PATH/rtb.py # csh/tcsh
12+
#
13+
# % rtb
14+
15+
# import stuff
16+
from math import pi
17+
import numpy as np
18+
import matplotlib as plt
19+
import roboticstoolbox as rtb
20+
from spatialmath import *
21+
from spatialmath.base import *
22+
23+
# setup defaults
24+
np.set_printoptions(linewidth=120, formatter={'float': lambda x: f"{x:8.4g}" if abs(x) > 1e-10 else f"{0:8.4g}"})
25+
SE3._ansimatrix = True
26+
27+
# print the banner
28+
# https://patorjk.com/software/taag/#p=display&f=Cybermedium&t=Robotics%20Toolbox%0A
29+
print(r"""____ ____ ___ ____ ___ _ ____ ____ ___ ____ ____ _ ___ ____ _ _
30+
|__/ | | |__] | | | | | [__ | | | | | | |__] | | \/
31+
| \ |__| |__] |__| | | |___ ___] | |__| |__| |___ |__] |__| _/\_
32+
33+
for Python
34+
35+
""")

0 commit comments

Comments
 (0)