Skip to content

Instantly share code, notes, and snippets.

View paulaksm's full-sized avatar

Paula Moraes paulaksm

View GitHub Profile
@paulaksm
paulaksm / download.sh
Last active June 4, 2018 01:41
Test for gradient descent implementation (put the files in 'ep-grad-desc/' directory)
#!/bin/bash
wget https://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-white.csv
@paulaksm
paulaksm / NXTpy.java
Created March 20, 2018 14:02
Python <-> Java
/* 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
{
@paulaksm
paulaksm / motion.py
Created March 20, 2018 01:19
use with NXTtr.java
'''
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
@paulaksm
paulaksm / teste_cam.py
Last active March 13, 2018 13:38
Simple camera test for Python3 and OpenCV
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)
@paulaksm
paulaksm / USBInterface.py
Last active March 21, 2018 18:53
Test for NXT-PC communication via USB
# 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.
#
@paulaksm
paulaksm / NXTtr.java
Created March 3, 2018 13:28
Brick code for NXTremoteControl_TA.java
/* 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
{
@paulaksm
paulaksm / NXTremoteControl_TA.java
Last active March 7, 2018 15:47
PC controller for NXTtr.java
/*
* 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