Spawn an ipython shell
but bail if errors in imported toolboxes
-#!/usr/bin/env python3 -i
+#!/usr/bin/env python3
# a simple Robotics Toolbox "shell", runs Python3 and loads in NumPy, RTB, SMTB
#
@@ -21,6 +21,7 @@ import roboticstoolbox as rtb # lgtm [py/unused-import]
from spatialmath import * # lgtm [py/polluting-import]
from spatialmath.base import * # lgtm [py/polluting-import]
+
# setup defaults
np.set_printoptions(linewidth=120, formatter={'float': lambda x: f"{x:8.4g}" if abs(x) > 1e-10 else f"{0:8.4g}"})
SE3._ansimatrix = True
@@ -55,3 +56,7 @@ if args.script is not None:
if not path.exists():
raise ValueError(f"script does not exist: {args.script}")
exec(path.read_text())
+
+# drop into IPython
+import IPython
+IPython.embed()
\ No newline at end of file
