forked from AlbatozK/PySimbot
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathexample2_sensors.py
More file actions
25 lines (18 loc) · 800 Bytes
/
Copy pathexample2_sensors.py
File metadata and controls
25 lines (18 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python3
import os, platform
if platform.system() == "Linux" or platform.system() == "Darwin":
os.environ["KIVY_VIDEO"] = "ffpyplayer"
from pysimbotlib.core import PySimbotApp, Robot
from kivy.logger import Logger
from kivy.config import Config
# Force the program to show user's log only for "info" level or more. The info log will be disabled.
Config.set('kivy', 'log_level', 'info')
# update robot every 0.5 seconds (2 frames per sec)
REFRESH_INTERVAL = 1/2
class MyRobot(Robot):
def update(self):
Logger.info("Smell Angle: {0}".format(self.smell()))
Logger.info("Distance: {0}".format(self.distance()))
if __name__ == '__main__':
app = PySimbotApp(robot_cls=MyRobot, num_robots=1, interval=REFRESH_INTERVAL, enable_wasd_control=True)
app.run()