-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitPymlab.py
executable file
·115 lines (101 loc) · 3.63 KB
/
initPymlab.py
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env python
import sys
import pymlab
import rospy
import time
from pymlab import config
import arom
from arom.msg import *
from arom.srv import *
from std_msgs.msg import String
#from sensor_server.srv import *
#from sensor_server.msg import *
if __name__ == "__main__":
i2c = str({
"device": "smbus",
"port": 1,
})
bus = str([
{
"name": "AWS_humi",
"type": "sht31",
"address": 0x44,
#},{
# "name": "AWS_humi",
# "type": "sht31",
# "address": 0x00,
},{
"name": "AWS_wind_s",
"type": "rps01",
"address": 0x40,
},{
"name": "AWS_temp_ref",
"type": "lts01",
"address": 0x48,
},{
"name": "AWS_wind_d",
"type": "mag01",
"gauss": 0.88,
"address": 0x1E,
},{
"name": "AWS_press",
"type": "altimet01",
"address": 0x60,
},{
"name": "AWS_light",
"type": "isl03",
"address": 0x10,
},{
"name": "AWS_clouds",
"type": "thermopile01",
"address": 0x5d,
},{
"name": "StatusLCD",
"type": "i2clcd",
"address": 0x27,
}#,{
# "name": "AWS_humi_in",
# "type": "sht25"
#}#,{
# "name": "dd_temp_g0a",
# "type": "sht25"
#}
#,{
# "name": "dd_heater_g0a",
# "type": "i2cpwm",
#}#{
# "name": "io",
# "type": "i2cio",
#},
])
i2c2 = str({
"device": "serial",
"port": '/dev/ttyUSB0',
})
bus2 = str([
{
"name": "telescope_lts",
"type": "lts01",
"address": 0x48
},{
"name": "telescope_spi",
"type": "i2cspi",
"address": 0x2E
},
{
"name": "gpio_mount",
"type": "I2CIO_TCA9535",
"address": 0x26
}#,{
# "name": "telescope_magnetometer",
# "type": "mag01",
# "gauss": 0.88,
# "address": 0x1E,
#}
])
msg_pymlab = rospy.Publisher('pymlab_server', msg_pymlabInit, queue_size=10)
rospy.init_node('pymlab_client', anonymous=True)
pymlab = rospy.ServiceProxy('pymlab_init', PymlabInit)
print "smbus -", pymlab(i2c=i2c, bus=bus)
print "serial -", pymlab(i2c=i2c2, bus=bus2)
msg_pymlab.publish(name = "", data="{'start': True}")