Skip to content

Instantly share code, notes, and snippets.

View plusk01's full-sized avatar

Parker Lusk plusk01

View GitHub Profile
@plusk01
plusk01 / edison-uboot-sd.md
Last active March 10, 2020 22:15
Researching how to do U-Boot OTA using the external SD card on the Intel Edison

Intel Edison OTA w/ SD Card

This Gist attempts to document the research and (hopefully) steps to successfully allowing U-Boot to perform an OTA (over-the-air) update.

Please comment with corrections and suggestions!

Performing an OTA Update: Place the contents of the toFlash directory onto the update partition of the Intel Edison. Then, at the U-Boot prompt run do_ota. Or, if the system is running in multi-user mode, run as root: reboot ota.

Motivation: Currently (Yocto 2.1, Intel Edison) has an update partition of ~800MB. The Yocto toFlash directory is ~500MB, so placing it on to the update partition is no problem, allowing an OTA update through U-Boot. However, to do an OTA update using Emutex Labs' Ubilinxu is currently impossible as the Ubilinux toFlash directory is ~1.6GB.

@plusk01
plusk01 / ros-kinetic-macosx.md
Last active December 26, 2019 02:46
Installing ROS Kinetic on Mac OS X El Capitan (10.11.6) and macOS Sierra

Installing ROS Kinetic on Mac OS X - El Capitan and macOS Sierra

Having rather painlessly installed ROS Indigo on El Capitan using Mike Purvis's script, I attempted to upgrade to ROS Kinetic. This gist outlines the problems I encoutered and how I solved them. Hopefully this guide will help others attempting to install ROS Kinetic / Gazebo 7 on El Capitan.

ROS Install OSX

Start with Mike Purvis's script, which currently is setup to install ROS Indigo. In order to install Kinetic instead of Indigo, make sure to set the ROS_DISTRO environment variable: export ROS_DISTRO=kinetic.

After you get through rosdep errors, it's quickest to just work with the catkin config ... and catkin build ... commands directly. In fact, I found it most helpful to leave my catkin workspace terminal open at ros-install-osx/kinetic_desktop_full_ws and t

@plusk01
plusk01 / matlab-things.md
Last active November 28, 2016 18:09
A place for MATLAB conveniences and tips, etc

MATLAB Things

A place to post useful MATLAB things.

Lambda Functions

Complex Multivariate Normal PDF

Like MATLAB's mvnpdf but takes in complex values. See wikipedia. Note that definitions are slightly different. Below, Cz = E{ZZ'}, Pz = E{ZZ.'}, and \Gamma = conj(Cz) - Pz'*inv(Cz)*Pz where X' means Hermitian and X.' means transpose in MATLAB.

@plusk01
plusk01 / yaml_to_latex.py
Last active February 22, 2017 00:57
Python script to convert OpenCV YAML to LaTeX bmatrix
#!/usr/bin/python
"""
I'm expecting a YAML file from OpenCV that looks like:
%YAML:1.0
K: !!opencv-matrix
rows: 3
cols: 3
dt: d
@plusk01
plusk01 / beecore-stm32f3x-debug.md
Last active March 9, 2017 04:49
Programming/Debugging a Beecore STM32F3 board
@plusk01
plusk01 / triple-boot-macos.md
Last active August 19, 2017 14:19
MacBook Pro 2012 10,1: macOS Sierra + Win10 + Ubuntu 16.04
@plusk01
plusk01 / gazebo-kill.md
Created August 25, 2017 15:58
Kill gazebo process quicker

To make Gazebo die sooner, edit the file at /opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/nodeprocess.py:

Near line 57, change the timeouts to be:

_TIMEOUT_SIGINT  = 0.5 #seconds
_TIMEOUT_SIGTERM = 0.5 #seconds

This will cause ROS to send a kill signal much sooner.

@plusk01
plusk01 / bagcut.sh
Created May 3, 2018 23:23
BASH function to split ROS bags
# Use rosbag filter to create a new bag
#
# $ bagcut original.bag 0 336 # cuts from 0 to 336s
#
# $ bagcut original.bag 50 # new bag starts 50s in
#
# $ bagcut original.bag 10 -20 # cuts from 10 to END_TIME-20s
function bagcut {
BAG=${1:0:-4}
OFFSET=$2
@plusk01
plusk01 / taskset_example.md
Last active February 14, 2023 20:43
Understanding CPU affinity with taskset

CPU Affinity

In a single core system, the OS allows multiple processes to run by sharing CPU time with the multiple processes. This is called concurrency, which gives the illusion of multiple processes executing at once, but is in fact just using a scheduler to give each process dedicated time on the CPU. The time associated with switching processes on a single core is overhead caused by context switching.

When a multi-core processor is available to an OS (e.g., Linux), the scheduler will do its best to allow processes to run simultaneously (by placing processes on different cores) in addition to running concurrently (different processes on the same core).

To control which core a process runs on, we can tell the scheduler to give a process a certain affinity towards a given set of CPUs.

Using taskset, we can get/set the CPU affinity of a particular process. Consider the following example.

@plusk01
plusk01 / wifi_select.sh
Created April 22, 2019 14:59
Utility for switching between wpa_supplicant wireless connections
#!/bin/bash
#
# NetworkManager is trash for robots (periodic scanning causes
# ~3s latency every 2 minutes). We have disabled Network Manager
# (systemctl disable network-manager) and network interfaces are
# now managed via /etc/network/interfaces, with authenticated
# wireless managed by wpa_supplicant.
#
# Your /etc/network/interfaces probably looks like:
#