-
Notifications
You must be signed in to change notification settings - Fork 11
/
load-actions.scm
36 lines (29 loc) · 980 Bytes
/
load-actions.scm
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
26
27
28
29
30
31
32
33
34
35
36
;
; ghost-bridge-action-node module.
;
; Provides interfaces for making physical movements, and
; for saying things.
(define-module (opencog ghost-bridge-action-node))
(use-modules (opencog) (opencog atom-types) (opencog python))
(load "actions.scm")
; Try loading the python code from this directory; else got for the
; install directory. This assumes that the the current directory
; is in the python sys.path.
;
; If roscore is not running, then the load will hang. Thus, to avoid the
; hang, we test to see if we can talk to roscore. If we cannot, then load
; only the debug interfaces.
;
;
(define-public (start-ghost-bridge-action-node)
(python-eval "
try:
import rosgraph
# Throw an exception if roscore is not running.
rosgraph.Master('/rostopic').getPid()
# Exec the action_node
exec(open('action_node.py').read())
print('Loaded the OpenCog ROS Action API')
except Exception as e:
print('Error loading the OpenCog Action API', e)
"))