Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
172 changes: 0 additions & 172 deletions examples/twistdemo.py

This file was deleted.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ docs = [

[project.scripts]

eigdemo = "roboticstoolbox.examples.eigdemo:main"
tripleangledemo = "roboticstoolbox.examples.tripleangledemo:main"
twistdemo = "roboticstoolbox.examples.twistdemo:main"
eigdemo = "roboticstoolbox.demo.eigdemo:main"
tripleangledemo = "roboticstoolbox.demo.tripleangledemo:main"
twistdemo = "roboticstoolbox.demo.twistdemo:main"
rtbtool = "roboticstoolbox.bin.rtbtool:main"


Expand Down Expand Up @@ -188,4 +188,4 @@ filterwarnings = [
]

[tool.coverage.run]
omit = ["src/roboticstoolbox/examples/*", "test_*.py"]
omit = ["src/roboticstoolbox/demo/*", "test_*.py"]
Empty file.
9 changes: 8 additions & 1 deletion examples/eigdemo.py → src/roboticstoolbox/demo/eigdemo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python
"""
Eigenvalue demonstration

Expand Down Expand Up @@ -76,13 +77,19 @@ def animate(theta):


def main():
# eigdemo() prints λ1/λ2 -- on Windows, stdout defaults to the legacy
# cp1252 console codepage (which can't encode λ) whenever it isn't a
# real console, e.g. piped/redirected output. reconfigure() (3.7+)
# forces UTF-8 regardless.
if hasattr(sys.stdout, "reconfigure"):
sys.stdout.reconfigure(encoding="utf-8")

def help():
print("eigdemo # uses default matrix [1 2; 3 4]")
print("eigdemo a b c d # uses matrix [a b; c d]")
sys.exit(0)

if sys.argv in ("-h", "--help", "help"):
if any(arg in ("-h", "--help", "help") for arg in sys.argv[1:]):
help()

if len(sys.argv) == 5:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@author Jesse Haviland
"""

import sys
import swift
from math import pi
import roboticstoolbox as rtb
Expand Down Expand Up @@ -78,7 +79,7 @@ def convert(R):
plane.T = convert(R1 * R2 * R3 * SO3.Ry(pi / 2) * SO3.Rz(pi / 2))


def demo():
def demo(test: bool = False):
# TODO
# rotate the rings according to the rotation axis, so that the axles
# point the right way
Expand Down Expand Up @@ -224,12 +225,14 @@ def angle(index, ring):
update_gimbals(0, 2)
update_gimbals(0, 3)

while True:
env.step(0)
# duration=None runs until the browser disconnects (or forever, ^C to
# stop); a bounded duration lets --test smoke-test this demo without
# needing a browser at all (see SWIFT_HEADLESS in swift's launch()).
env.run(duration=0.5 if test else None)


def main():
demo()
demo(test="--test" in sys.argv[1:])


if __name__ == "__main__":
Expand Down
Loading