Skip to content

Commit cd085f8

Browse files
committed
browser support
1 parent f18652c commit cd085f8

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

examples/swift_recording.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
# Launch the simulator Swift
1818
env = rtb.backend.Swift()
19-
env.launch()
19+
20+
# Launch the sim in chrome as only chrome supports webm videos
21+
env.launch('google-chrome')
2022

2123
# Create a Panda robot object
2224
panda = rtb.models.Panda()

roboticstoolbox/backend/Swift/Swift.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,16 @@ def __init__(self, realtime=True, display=True):
8383
# Basic methods to do with the state of the external program
8484
#
8585

86-
def launch(self):
86+
def launch(self, browser=None):
8787
"""
88-
Launch a graphical backend in Swift
88+
Launch a graphical backend in Swift by default in the default browser
89+
or in the specified browser
90+
91+
:param browser: browser to open in: one of
92+
'google-chrome', 'chrome', 'firefox', 'safari', 'opera'
93+
or see for full list
94+
https://docs.python.org/3.8/library/webbrowser.html#webbrowser.open_new
95+
:type browser: string
8996
9097
``env = launch(args)`` create a 3D scene in a running Swift instance as
9198
defined by args, and returns a reference to the backend.
@@ -95,7 +102,7 @@ def launch(self):
95102
super().launch()
96103

97104
if self.display:
98-
sw.start_servers(self.outq, self.inq)
105+
sw.start_servers(self.outq, self.inq, browser=browser)
99106
self.last_time = time.time()
100107

101108
def step(self, dt=0.05):

0 commit comments

Comments
 (0)