-
Notifications
You must be signed in to change notification settings - Fork 22
/
RobotOS.jl
50 lines (41 loc) · 1.23 KB
/
RobotOS.jl
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
module RobotOS
using PyCall
#Empty imported modules for valid precompilation
const _py_sys = PyCall.PyNULL()
const _py_ros_callbacks = PyCall.PyNULL()
const __rospy__ = PyCall.PyNULL()
const __tf__ = PyCall.PyNULL()
include("debug.jl")
include("time.jl")
include("gentypes.jl")
include("rospy.jl")
include("pubsub.jl")
include("services.jl")
include("callbacks.jl")
include("tf.jl")
function __init__()
#Put julia's ARGS into python's so remappings will work
copy!(_py_sys, pyimport("sys"))
if length(ARGS) > 0
_py_sys.argv = ARGS
end
#Fill in empty PyObjects
if ! (dirname(@__FILE__) in _py_sys."path")
pushfirst!(_py_sys."path", dirname(@__FILE__))
end
copy!(_py_ros_callbacks, pyimport("ros_callbacks"))
copy!(__tf__, pyimport("tf"))
try
copy!(__rospy__, pyimport("rospy"))
catch ex
if (isa(ex, PyCall.PyError) &&
pycall(pybuiltin("str"), PyAny, ex.val) == "No module named rospy")
error("rospy not found!\nHas an environment setup script been run?")
else
rethrow(ex)
end
end
#Compile the callback notify function, see callbacks.jl
CB_NOTIFY_PTR[] = @cfunction(_callback_notify, Cint, (Ptr{Cvoid},))
end
end