Skip to content

Instantly share code, notes, and snippets.

Avatar

Darko Lukić lukicdarkoo

View GitHub Profile
@lukicdarkoo
lukicdarkoo / convert.py
Last active Sep 2, 2021
Webots VRML conversion script
View convert.py
# Converts rotation and translation VRML fields.
# It takes the clipboard content, applies transforms, and pastes the transformed VRML to the clipboard.
#
# Dependencies:
#
# pip3 install clipboard numpy transforms3d
# sudo apt install xclip
#
# GNOME SHORTCUT
# In GNOME, you can run the script as a keyboard shortcut.
@lukicdarkoo
lukicdarkoo / tutorial.md
Last active Feb 15, 2022
VNC with NVIDIA acceleration (without display)
View tutorial.md

Server Configuration

Install VirtualGL and TurboVNC

# Install VirtualGL
wget https://nav.dl.sourceforge.net/project/virtualgl/2.6.5/virtualgl_2.6.5_amd64.deb
sudo apt install ./virtualgl_2.6.5_amd64.deb

# Install TurboVNC
@lukicdarkoo
lukicdarkoo / Makefile
Created Apr 15, 2021
Plugin System using `dlopen`
View Makefile
all:
g++ -shared -fPIC MyPlugin.cpp -o myplugin.so
g++ main.cpp -o main -ldl
View actor_critic.py
import gym
import numpy as np
import torch
import torch.nn
from torch.nn.functional import smooth_l1_loss, relu, softmax
class ActorCriticNet(torch.nn.Module):
def __init__(self, n_states=4, n_hidden=128, n_actions=2):
super().__init__()
@lukicdarkoo
lukicdarkoo / arraycuckoo.c
Created Nov 24, 2020
Python Buffer Protocol Example
View arraycuckoo.c
#include <Python.h>
typedef struct {
PyObject_HEAD char *arr;
int len;
} ArrayCuckoo;
static int ArrayCuckoo_init(ArrayCuckoo *self, PyObject *args, PyObject *kwds) {
self->len = 2;
self->arr = (char *)malloc(self->len * sizeof(char));
View c_cpp_properties.json
{
"configurations": [
{
"name": "ROS2 Foxy",
"browse": {
"databaseFilename": "",
"limitSymbolsToIncludedHeaders": true
},
"includePath": [
"/home/lukic/webots/include/controller/cpp",
@lukicdarkoo
lukicdarkoo / egpu.bash
Last active Nov 28, 2020
Computer Vision with NVIDIA eGPU Configuration
View egpu.bash
# This script prepares your machine for computer vision challenges (with NVIDIA).
# Tested with Ubuntu 20.04 LTS and NVIDIA GeForce GTX 1070 (Aorus Gaming Box enclosure).
# Reddit post: https://www.reddit.com/r/eGPU/comments/io94qq/linux_aorus_gaming_box_for_robotics_and_computer/
#
# The script does the following:
# * Installs NVIDIA driver
# * Installs NVIDIA CUDA Toolkit (`nvcc`)
# * Installs NVIDIA CUDA Deep Neural Network library (cuDNN)
# * Installs OpenCV with CUDA support (WIP)
# * Installs TensorFlow with CUDA support
@lukicdarkoo
lukicdarkoo / e-puck2.wbt
Last active Sep 6, 2020
Log Webots position
View e-puck2.wbt
#VRML_SIM R2020b utf8
WorldInfo {
info [
"The model of the e-puck 2 robot"
]
title "e-puck simulation"
coordinateSystem "NUE"
}
Viewpoint {
orientation 0.04913069345659068 0.9922428678493876 0.11419398479121845 3.8679
View labelme2yolo.py
"""
Converts LabelMe annotations to annotations compatible with YOLO.
The script does the following:
- cleans (!) the output directory and prepare it for training,
- splits the dataset on validation and training,
- converts all LabelMe annoations (*.json) to YOLO annoations (*.txt) and
- creates YOLO metadata (`.data`, `.names`, `train.txt` and `valid.txt`)
"""
import os
@lukicdarkoo
lukicdarkoo / uwb.py
Last active Aug 29, 2020
UWB Follower
View uwb.py
# pip3 install pyserial
import time
import serial
import rclpy
import threading
from rclpy.node import Node
from std_msgs.msg import Int32