Skip to content

Instantly share code, notes, and snippets.

import numpy as np
import serial
import matplotlib.pyplot as plt
def parse_line(line):
try:
line = bytes([b for b in line if b != 0]).decode('ascii').strip()
#! /usr/bin/python3
from time import sleep
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from matplotlib.lines import Line2D
<table id='m_-3490595658229054110u_body'
style='border-collapse:collapse;table-layout:fixed;border-spacing:0;vertical-align:top;min-width:320px;Margin:0 auto;background-color:#eff4ff;width:100%'
cellpadding='0' cellspacing='0'>
<tbody>
<tr>
<td
style='display:none!important;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden'>
Do you have what it takes to build India's first Driverless Campus Shuttle
</td>
</tr>
@surajRathi
surajRathi / CMakeLists.txt
Created January 7, 2023 18:08
Simple ros node to render polynomials as markers in rviz.
cmake_minimum_required(VERSION 3.0.2)
project(virat_msgs)
add_compile_options(-std=c++11)
find_package(catkin REQUIRED
roscpp
rospy
std_msgs
message_generation
@surajRathi
surajRathi / .zshrc.local
Created December 19, 2022 05:56
Ubuntu nspawn Container's Shell config.
HISTSIZE=10000000
SAVEHIST=10000000
# setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
@surajRathi
surajRathi / .zshrc.local
Last active July 14, 2023 20:00
Arch zsh config
export XDG_CONFIG_HOME=$HOME/.config
# HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000000
SAVEHIST=10000000
# setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
@surajRathi
surajRathi / sbg.launch
Last active December 16, 2022 16:38
Running SBG Ellipse N
<launch>
<node name="sbg_device" pkg="sbg_driver" type="sbg_device" output="screen">
<rosparam command="load" file="/home/suraj/ws/tmp/sbg/sbg.yaml" />
</node>
</launch>

To use devices inside your nspawn container do:

Edit systemd-nspawn@<machine_name>.service and add a line like the below

DeviceAllow="/dev/serial/by-id/usb-Roboteq_Motor_Controller_SDC2XXX-if00 rwm"
DeviceAllow=char-ttyACM rwm
DeviceAllow=char-usb_device rwm
DeviceAllow=ttyACM rwm

To see valid device types do:

@surajRathi
surajRathi / jupyter_remote.sh
Created December 10, 2022 12:39
open https://localhost:8080 on the local machine
ssh -L 8080:localhost:8021 [email protected] python -m jupyter notebook --port=8021

From the USB/IP site:

USB/IP Project aims to develop a general USB device sharing system over IP network. To share USB devices between computers with their full functionality, USB/IP encapsulates "USB I/O messages" into TCP/IP payloads and transmits them between computers. Goes without saying, make sure host and client are on the same network.

Host Setup
  • Install usbip package