Skip to content

Commit

Permalink
Merge pull request #3 from NVIDIA-AI-IOT/master
Browse files Browse the repository at this point in the history
Merge back
  • Loading branch information
tokk-nv authored Aug 26, 2020
2 parents 123eb0b + d51c395 commit 2435c6d
Show file tree
Hide file tree
Showing 5 changed files with 391 additions and 6 deletions.
12 changes: 10 additions & 2 deletions jetbot/apps/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,16 @@
# 128x32 display with hardware I2C:
disp = Adafruit_SSD1306.SSD1306_128_32(rst=None, i2c_bus=1, gpio=1) # setting gpio to 1 is hack to avoid platform detection

# Initialize library.
disp.begin()
while True:

try:
# Try to connect to the OLED display module via I2C.
disp.begin()
except OSError as err:
print("OS error: {0}".format(err))
time.sleep(10)
else:
break

# Clear display.
disp.clear()
Expand Down
17 changes: 15 additions & 2 deletions jetbot/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,24 @@ def platform_is_nano():


def get_ip_address(interface):
if get_network_interface_state(interface) == 'down':
state = get_network_interface_state(interface)
if state == 'down' or state == None:
return None

cmd = "ifconfig %s | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'" % interface
return subprocess.check_output(cmd, shell=True).decode('ascii')[:-1]


def get_network_interface_state(interface):
return subprocess.check_output('cat /sys/class/net/%s/operstate' % interface, shell=True).decode('ascii')[:-1]
if not os.path.exists('/sys/class/net/%s/operstate' % interface):
#print("%s file does NOT exist" % interface)
return None

try:
status = subprocess.check_output('cat /sys/class/net/%s/operstate' % interface, shell=True).decode('ascii')[:-1]
except Exception as err:
print("Exception: {0}".format(err))
return None
else:
return status

4 changes: 2 additions & 2 deletions notebooks/collision_avoidance/train_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
"version": "3.6.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
Loading

0 comments on commit 2435c6d

Please sign in to comment.