Skip to content

Instantly share code, notes, and snippets.

View yossioo's full-sized avatar
🎯
Focusing

Yossi Ovcharik yossioo

🎯
Focusing
View GitHub Profile
@yossioo
yossioo / python-gst.py
Created April 18, 2020 05:52
Simple example to demonstrate dynamically adding and removing source elements to a playing pipeline.
#!/usr/bin/env python3
''' https://github.com/GStreamer/gst-python/blob/master/examples/dynamic_src.py
Simple example to demonstrate dynamically adding and removing source elements
to a playing pipeline.
'''
import sys
import random
@yossioo
yossioo / state_machine.cpp
Created April 7, 2020 22:06
Simple state machine in C++
#include <iostream>
#include <functional>
#include <vector>
class StateMachine
{
public:
StateMachine() = default;
~StateMachine() = default;
@yossioo
yossioo / node_with_parameters.py
Created March 6, 2020 11:01
Example node with grouped parameters
#!/usr/bin/python3
from rclpy.node import Node
import rclpy
if __name__ == "__main__":
rclpy.init()
node = Node("node_w_params")
node.declare_parameter("param_a")
node.declare_parameter("group_a.param_b")
@yossioo
yossioo / ros2-install.sh
Last active February 19, 2020 10:20
ros2-install.sh
#!/bin/bash
set -e
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
sudo apt update && sudo apt install -y curl gnupg2 lsb-release
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64,arm64] http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
# This script is not executable :) Use it only for reference
# 30 GB:
truncate -s $((1024*30))M image.img
/sbin/mkfs -t ext4 -q image.img
mkdir ~/image_contents
sudo mount -o loop image.img ~/image_contents
sudo chown -R $USER:$USER ~/image_contents
sudo umount ~/image_contents
@yossioo
yossioo / PropertyHelper.h
Created December 1, 2019 08:34 — forked from Rolias/PropertyHelper.h
Qt Auto Property Macros
#pragma once
#include <QObject>
//See Gist Comment for description, usage, warnings and license information
#define AUTO_PROPERTY(TYPE, NAME) \
Q_PROPERTY(TYPE NAME READ NAME WRITE NAME NOTIFY NAME ## Changed ) \
public: \
TYPE NAME() const { return a_ ## NAME ; } \
void NAME(TYPE value) { \
if (a_ ## NAME == value) return; \
a_ ## NAME = value; \
@yossioo
yossioo / gist:e1deda44b28b5724f2a8e5d33bcf8a7e
Created June 23, 2019 06:11
CMakeLists.txt search for variable
...
set(searchPattern "AMENT")
message(STATUS "========== Listing variables w/ search pattern: ${searchPattern}")
get_cmake_property(_variableNames VARIABLES)
list(SORT _variableNames)
foreach (_variableName ${_variableNames})
if (_variableName MATCHES .*${searchPattern}.*)
message(STATUS "${_variableName}=${${_variableName}}")
endif ()
endforeach ()
@yossioo
yossioo / GpsUtils.cs
Created May 5, 2019 12:04 — forked from govert/GpsUtils.cs
Convert WGS-84 geodetic locations (GPS readings) to Cartesian coordinates in a local tangent plane (Geodetic to ECEF to ENU)
using System;
using System.Diagnostics;
using static System.Math;
// Some helpers for converting GPS readings from the WGS84 geodetic system to a local North-East-Up cartesian axis.
// The implementation here is according to the paper:
// "Conversion of Geodetic coordinates to the Local Tangent Plane" Version 2.01.
// "The basic reference for this paper is J.Farrell & M.Barth 'The Global Positioning System & Inertial Navigation'"
// Also helpful is Wikipedia: http://en.wikipedia.org/wiki/Geodetic_datum
@yossioo
yossioo / geo.py
Created May 5, 2019 11:59 — forked from sbarratt/geo.py
This script provides coordinate transformations between geodetic, ecef and enu in python. Based on https://gist.github.com/govert/1b373696c9a27ff4c72a.
"""
This script provides coordinate transformations from Geodetic -> ECEF, ECEF -> ENU
and Geodetic -> ENU (the composition of the two previous functions). Running the script
by itself runs tests.
based on https://gist.github.com/govert/1b373696c9a27ff4c72a.
"""
import math
a = 6378137
b = 6356752.3142
@yossioo
yossioo / CMakeLists.txt
Created January 21, 2019 13:33
example cmake with ROS and Qt
##############################################################################
# CMake
##############################################################################
cmake_minimum_required(VERSION 2.8.0)
project(show_laser)
##############################################################################
# Catkin
##############################################################################