-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathcheck_pcan.py
More file actions
28 lines (24 loc) · 777 Bytes
/
check_pcan.py
File metadata and controls
28 lines (24 loc) · 777 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
26
27
28
import os
import configparser
os.system("ls /dev | grep pcan > pcan_available.txt")
config = configparser.ConfigParser()
config.sections()
config.read("build/bin/robot_interface.cfg")
#print (config.sections())
#print (config["WheelchairParameters"]["controller_port"])
#print (config["WheelchairParameters"]["joystick_port"])
file = open("pcan_available.txt", "r")
line_count = 0
for line in file:
line_str = line.strip()
line_str2 = "/dev/" + line_str
#print(line_str2)
if(line_count==0):
config["WheelchairParameters"]["controller_port"] = line_str2
elif(line_count==1):
config["WheelchairParameters"]["joystick_port"] = line_str2
else:
break
line_count= line_count+1
with open('build/bin/robot_interface.cfg', 'w') as configfile:
config.write(configfile)