aboutsummaryrefslogtreecommitdiffstats
path: root/System/system_swingup_test_2.py
diff options
context:
space:
mode:
authorRaspberry Pi <raspberrypi@umn.edu>2019-11-26 19:55:38 -0600
committerRaspberry Pi <raspberrypi@umn.edu>2019-11-26 19:55:38 -0600
commit50c1d34f709997fbac75e94940d247e6c48ef45a (patch)
tree9928a0b8bf8d04aba7c3fe8ef2db315fea20cccd /System/system_swingup_test_2.py
parentMerge remote-tracking branch 'origin/library_encoder_thread' (diff)
downloadee4511w-50c1d34f709997fbac75e94940d247e6c48ef45a.tar
ee4511w-50c1d34f709997fbac75e94940d247e6c48ef45a.tar.gz
ee4511w-50c1d34f709997fbac75e94940d247e6c48ef45a.tar.bz2
ee4511w-50c1d34f709997fbac75e94940d247e6c48ef45a.tar.lz
ee4511w-50c1d34f709997fbac75e94940d247e6c48ef45a.tar.xz
ee4511w-50c1d34f709997fbac75e94940d247e6c48ef45a.tar.zst
ee4511w-50c1d34f709997fbac75e94940d247e6c48ef45a.zip
Improve logging: add timestamps for each log. Add a new function to add other messages to the log file. Update swingup test to use new logging behavior.
Diffstat (limited to '')
-rw-r--r--System/system_swingup_test_2.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/System/system_swingup_test_2.py b/System/system_swingup_test_2.py
index 5c0ac5a..cb646ef 100644
--- a/System/system_swingup_test_2.py
+++ b/System/system_swingup_test_2.py
@@ -156,6 +156,10 @@ class SwingUpEnv():
def end(self):
self.sys.deinitialize()
+
+ def log(self, message):
+ self.sys.add_log(message)
+ print(message)
class nnQ(pt.nn.Module):
@@ -368,7 +372,8 @@ try:
R.append(C)
UpTime.append(max_up_time)
#print('t:',ep+1,', R:',C,', L:',t-1,', G:',G,', Q:', Q_est, 'U:', max_up_time)
- print('Episode:',ep, 'Total Steps:',step, ', Ave. Reward:',C, ', Episode Length:',t-1, 'Max Up-Time:',max_up_time)
+ log = "Episode:" + str(ep) + " Total Steps:" + str(step) + " Ave. Reward:" + str(C) + " Episode Length:" + str(t-1) + " Max Up-Time:" + str(max_up_time)
+ env.log(log)
except:
env.end()
exit(-1)