This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* September 21, 2009 | |
* Author Tawat Atigarbodee | |
* Modified in March 03, 2018 | |
* This program creates a Control Window for controlling NXT brick running NXTtr.java via USB. | |
* | |
* To compile this program. | |
* - Install Lejos 0.8.5 | |
* - Include Lejos_nxj library to the project path | |
* - Compiled with nxjpcc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Application for brick, compiled with nxjc | |
Client-Server architecture | |
Commands sent by NXTremoteControl_TA.java*/ | |
import java.io.*; | |
import lejos.nxt.*; | |
import lejos.nxt.comm.*; | |
public class NXTtr | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# USB socket communication with LEGO Minstorms NXT -- adapted from nxt-python library | |
# Copyright (C) 2006, 2007 Douglas P Lau | |
# Copyright (C) 2009 Marcus Wanner | |
# Copyright (C) 2011 Paul Hollensen, Marcus Wanner | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
''' | |
CAMERA TEST | |
''' | |
cam = cv2.VideoCapture(0) | |
ret, frame = cam.read() | |
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) | |
cv2.imwrite('gray.png', gray) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Uses USB connection (requires pyusb and udev rules for lego USB) | |
Tries to increase velocity using synchronized motors for forward and backward motion. | |
Is possible to increase power up to 60 in weak_turn() calls, but it best behaves with 40 | |
''' | |
import nxt | |
import time | |
import keyboard as key | |
import USBInterface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Application for brick, compiled with nxjc | |
Client-Server architecture | |
Commands sent by NXTremoteControl_TA.java*/ | |
import java.io.*; | |
import lejos.nxt.*; | |
import lejos.nxt.comm.*; | |
public class NXTpy | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
wget https://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-white.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If under a valid institutional IP address, the followng command will download an IEEE hosted paper of a specific <ID-NUMBER> | |
and saved it as paper.pdf | |
wget "http://ieeexplore.ieee.org/stampPDF/getPDF.jsp?tp=&isnumber=&arnumber=<ID-NUMBER>" -O paper.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' Generate HDF5 files for array images and their labels... unfortunately this function won't work inside the Kaggle kernel | |
because of its limited resources | |
''' | |
def create_data_labels(height=256, width=455, channels=3, filename='driving'): | |
data_filename = filename + '_data' | |
label_filename = filename + '_labels' | |
txt_labels = pd.read_csv('../input/driving_dataset/driving_dataset/data.txt', sep=" ", header=None) | |
path = '../input/driving_dataset/driving_dataset/' | |
hdf5_file = h5py.File('self_driving_dataset.hdf5', mode='w') | |
hdf5_file.create_dataset(data_filename, (txt_labels.shape[0], height, width, channels), np.uint8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!ln -sf /opt/bin/nvidia-smi /usr/bin/nvidia-smi | |
!pip install gputil | |
import psutil | |
import humanize | |
import os | |
import GPUtil as GPU | |
GPUs = GPU.getGPUs() | |
# XXX: only one GPU on Colab and isn’t guaranteed | |
gpu = GPUs[0] |
OlderNewer