Skip to content

Instantly share code, notes, and snippets.

View robwaat's full-sized avatar

Robert Watson robwaat

  • University of Strathclyde
  • Glasgow, UK
View GitHub Profile
@robwaat
robwaat / showColor.m
Created January 18, 2025 17:36
Matlab: Show Color
function showColor(rgb)
%SHOWCOLOR Display a colorswatch of the given rgb value
arguments
rgb (1,3) {mustBeNonnegative, mustBeLessThanOrEqual(rgb, 255)} % 1x3 vector of RGB values.
end
% Validate & handle colors in 8-bit format
max_val = max(rgb);
float_tol = 1e-12;
if max_val > 1
@robwaat
robwaat / None.m
Last active December 21, 2023 13:32
Re-Use Matlab Figures
classdef None
%None Empty placeholder class
methods
function obj = None()
%NONE Construct an instance of this class
end
end
end
@robwaat
robwaat / Px4InjectParams.md
Created June 30, 2021 17:38
Modify a Px4 parameter file to include preferred values from a previous setup.

Px4 Inject Params

A Python utility used to update a target Px4 parameter configuration file with existing preferred values given in a source file.

This can be very helpful to retain calibration and setup when re-flashing flight controller firmware.

Usage

Below are some basic instructions on how to use this script.

@robwaat
robwaat / QGroundControl_Shortcut.md
Last active October 17, 2024 10:06
A quick list of steps required to allow the use of QGround Control through the standard Ubuntu launcher.

QGroundControl Shortcut

A quick list of steps required to allow the use of QGround Control through the standard Ubuntu launcher. This prevents having to manually locate the AppImage file each time the program is opened.

Steps

We can achieve the above by creating a Ubuntu desktop file, used to point the system at the required resources. It's a lot like a shortcut in Windows, but specific to the Ubuntu launcher.

  1. Download the latest (stable) version of QGroudControl for Linux from the distribution site. Make sure to follow the listed pre-requisite installation steps if this is a clean install.
  2. The luancher's link to the AppImage file will be static, so we need to make a permanent place to put it. It's less likely to be accidentally disturbed if this isn't your downloads folder, so we'll make a dedicated directory.
@robwaat
robwaat / Export_UCS.iLogicVb
Last active February 10, 2022 19:25
Export the homogeneous transform matrix from a user coordinate system in Autodesk Inventor.
' Ask user to select Coordinate Frame of Interest
Dim oUCS As UserCoordinateSystem = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kUserCoordinateSystemFilter, "Select UCS")
' Handle No selection case
If oUCS Is Nothing Then Exit Sub
' Extract document name
Dim oDocName As String = ThisDoc.FileName
' Extract UCS name
@robwaat
robwaat / Ubuntu_Customisation.md
Last active July 29, 2023 01:30
A list of aesthetic tweaks and customisations to get a fresh Ubuntu 20.04 install how I like it.

Ubuntu Customisation

A list of aesthetic tweaks to get a fresh ubuntu install how I like it.

  1. Set a desktop wallpaper. I like this one

  2. Install gnome desktop

    sudo apt install gnome-session gdm3
@robwaat
robwaat / UpdateMatlab.md
Last active February 25, 2021 18:17
Update Matlab

Update Matlab on Ubuntu

Updating Matlab on Ubuntu can be problematic owing to the permissions associated with the default install directory (e.g. /usr/local/MATLAB/R2020b) and the license manager.

However, per this Matlab Answers post, the process can be completed manually with the following command:

sudo ./usr/local/MATLAB/R2020b/bin/glnxa64/update_installer

Modification of the above may be necessary depending on the user's install directory. The install directory can be found within an active Matlab session by the command:

@robwaat
robwaat / NoOoze.gcode
Last active August 17, 2020 21:21
Custom g-code to reduce the impact of oozing during pre-print bed leveling.
M862.3 P "[printer_model]" ; printer model check
M862.1 P[nozzle_diameter] ; nozzle diameter check
M115 U3.9.0 ; tell printer latest fw version
G90 ; use absolute coordinates
M83 ; extruder relative mode
M104 S150 ; set extruder temp partway
M140 S[first_layer_bed_temperature] ; set bed temp
M190 S[first_layer_bed_temperature] ; wait for bed temp
M109 S150 ; wait for extruder temp partway
G28 W ; home all without mesh bed level
@robwaat
robwaat / matplotlib_cmap_extractor.py
Created June 18, 2020 16:18
Print the RGB values of matplotlib colormaps to the terminal
'''
Matplotlib Colormap Extractor
Print the RGB values of matplotlib colormaps to the terminal
'''
# Import matplotlib colormap
from matplotlib import cm
# Retrieve desired map
@robwaat
robwaat / _VS_Code_ROS_Debugging.md
Last active May 13, 2020 15:20
Debug ROS melodic with VS Code : Example Config

VS Code ROS Debugging

These template files may be used to configure Visual Studio Code in support of debugging C++ based ROS nodes.

Note that the and placeholders must be manually configured to target the user's project.