Skip to content

Instantly share code, notes, and snippets.

@sfalexrog
sfalexrog / on-the-sad-state-of-ros1-in-windows.md
Last active August 26, 2020 10:42
То, что я буду кидать каждый раз, когда будет всплывать разговор о "запуске ROS на Windows"

Так уж получается, что у большинства людей до сих пор основной системой стоит Windows, и они прилагают максимум усилий для того, чтобы эта система у них была ещё и единственной, даже если они занимаются робототехникой. Я не осуждаю этот выбор, в конце концов, у меня у самого есть железки, поддержка которых в Windows гораздо лучше, чем в Linux - но хочу донести до них несколько простых мыслей по поводу Windows и ROS.

Ещё раз, я ни в коем случае не пытаюсь сказать, что Windows - плохая операционная система, не пытаюсь доказать превосходство GNU/Linux, я всего лишь стараюсь показать, почему запуск ROS в Windows/WSL/WSL2 - не "серебряная пуля", позволяющая работать с ROS столь же комфортно, как и на GNU/Linux, стоящей на "настоящем" железе.

Итак, поехали:

  1. Я начну с маленькой лжи: ROS - это не какая-то монолитная программа наподобие фотошопа, автокада или ворда. Ложь здесь заключается в том, что ни фотошоп, ни автокад, ни ворд на самом деле тоже не монолитны - у них у всех есть богатая система дополнений, пл
@sfalexrog
sfalexrog / read_thrust.py
Created February 3, 2020 16:05
Read and print thrust using mavros and MAVLink
from __future__ import print_function
import rospy
from mavros import mavlink
from pymavlink import mavutil
from mavros_msgs.msg import Mavlink
rospy.init_node('thrust_read')
link = mavutil.mavlink.MAVLink('', 255, 1)
@sfalexrog
sfalexrog / egl_windowless_gbm.cpp
Created October 20, 2019 17:49
Windowless EGL on a Raspberry Pi 4 using GBM
#include <iostream>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
#include <assert.h>
#include <fcntl.h>
#include <gbm.h>
#include <unistd.h>
#define CHECK_EGL_ERROR() { EGLint error = eglGetError(); if (error != EGL_SUCCESS) {std::cerr << "EGL error at " << __LINE__ << ": " << std::hex << error << std::dec << std::endl;} }
@sfalexrog
sfalexrog / tfmini.py
Created May 17, 2019 10:36
tfmini with checksum
# -*- coding: utf-8 -*
import serial
ser = serial.Serial("/dev/ttyAMA0", 115200)
def getTFminiData():
while True:
count = ser.in_waiting
if count > 8:
recv = ser.read(9)
@sfalexrog
sfalexrog / Results.md
Last active February 13, 2019 14:19
Test results for NEON/non-NEON aruco detection
Board dictionary OpenCV w/o NEON, ns OpenCV w/NEON, ns Change
DICT_4X4_50 113232317 103567988 -8.5%
DICT_4X4_100 310450269 290968575 -6.3%
DICT_5X5_50 120566515 110379509 -8.4%
DICT_5X5_100 344844502 326884664 -5.2%
DICT_6X6_50 135857820 126517161 -6.9%
DICT_6X6_100 404778155 388300000 -4.1%
DICT_6X6_250 789037811 747213918 -5.3%
DICT_7X7_50 106657903 97923349 -8.1%
@sfalexrog
sfalexrog / optical_flow.patch
Created February 12, 2019 16:21
Patch for optical_flow.cpp to make its output conform to what px4flow module outputs
diff --git a/clever/src/optical_flow.cpp b/clever/src/optical_flow.cpp
index 3856eb7..37b63c0 100644
--- a/clever/src/optical_flow.cpp
+++ b/clever/src/optical_flow.cpp
@@ -77,7 +77,7 @@ private:
flow_.integrated_ygyro = NAN;
flow_.integrated_zgyro = NAN;
flow_.time_delta_distance_us = 0;
- flow_.distance = -1; // no distance sensor available
+ flow_.distance = 0; // no distance sensor available
@sfalexrog
sfalexrog / gist:5e5586f36ce3a92512f9011a75e5ecb7
Created January 14, 2019 15:02
Failed Clever image build log
+ SOURCE_IMAGE=http://repo.coex.space/2018-06-27-raspbian-stretch-lite.zip
+ export DEBIAN_FRONTEND=noninteractive
+ DEBIAN_FRONTEND=noninteractive
+ export LANG=C.UTF-8
+ LANG=C.UTF-8
+ export LC_ALL=C.UTF-8
+ LC_ALL=C.UTF-8
+ BUILDER_DIR=/builder
+ REPO_DIR=/builder/repo
+ SCRIPTS_DIR=/builder/repo/builder
@sfalexrog
sfalexrog / libi2c-dev_i2c-dev.h
Created January 7, 2019 19:42
linux/i2c-dev.h as provided by (a) linux-libc-dev, (b) libi2c-dev
/*
i2c-dev.h - i2c-bus driver, char device interface
Copyright (C) 1995-97 Simon G. Vogl
Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl>
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 2 of the License, or
(at your option) any later version.
@sfalexrog
sfalexrog / base.html
Created December 26, 2016 18:50
Пример наследования шаблонов
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
{# include all required js/css stuff here #}
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap/css/bootstrap.min.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap/css/bootstrap-theme.min.css') }}">
<script src="{{ url_for('static', filename='js/json3.min.js') }}"></script>
@sfalexrog
sfalexrog / 2791_class.py
Last active November 24, 2016 10:52
Любви к Python3 псто
# Edit 1: Use faster I/O
import random
import sys
class ImplicitNode:
def __init__(self, y, data):
self.y = y
self.data = data
self.left = None
self.right = None