Skip to content

Instantly share code, notes, and snippets.

View zhenzhenxiang's full-sized avatar

zhenzhenxiang

View GitHub Profile
#!/usr/bin/env python
import sys
import roslib;
import rospy
import rosbag
from rospy import rostime
import argparse
import os
# Original:
@zhenzhenxiang
zhenzhenxiang / polynomial_fitting.cpp
Created November 12, 2020 08:18 — forked from ksjgh/polynomial_fitting.cpp
Polynomial fitting
// In this quiz you'll fit a polynomial to waypoints.
#include <iostream>
#include "Dense"
using namespace Eigen;
/////////////////////////////////////////////////////////////////////////////////////////////
// Fit a polynomial.
// Adapted from
// https://github.com/JuliaMath/Polynomials.jl/blob/master/src/Polynomials.jl#L676-L716
#Removes all tfs except the one that has 'base_footprint' as child frame id
rosbag filter old.bag new.bag "topic != '/tf' or (len(m.transforms)>0 and m.transforms[0].child_frame_id=='base_footprint')"
#Same as above but limiting other topics to '/odom' and '/scan'
rosbag filter old.bag new.bag "topic == '/odom' or topic == '/scan' or (topic == '/tf' and len(m.transforms)>0 and m.transforms[0].child_frame_id=='imu_link')"
@zhenzhenxiang
zhenzhenxiang / timing.cpp
Created August 11, 2020 09:27
(C++) Measure execution time of a function
// C++ program to find out execution time of
// of functions
#include <algorithm>
#include <chrono>
#include <iostream>
using namespace std;
using namespace std::chrono;
// For demonstration purpose, we will fill up
@zhenzhenxiang
zhenzhenxiang / o.py
Created August 11, 2020 09:03
Simple Transparency for Drawing in OpenCV
import cv2
img = cv2.imread('lena.png')
# (1) create a copy of the original:
overlay = img.copy()
# (2) draw shapes:
cv2.circle(overlay, (133, 132), 12, (0, 255, 0), -1)
cv2.circle(overlay, (166, 132), 12, (0, 255, 0), -1)
# (3) blend with the original:
@zhenzhenxiang
zhenzhenxiang / Upgrade PCL from 1.7 to 1.8 on Ubuntu 16.04.md
Last active August 31, 2024 08:03
Upgrade PCL from 1.7 to 1.8 on Ubuntu 16.04

Upgrade PCL from 1.7 to 1.8 on Ubuntu 16.04

Uninstall PCL 1.7

  1. Remove libpcl-dev

    sudo apt remove libpcl-dev
  2. Remove libraries

@zhenzhenxiang
zhenzhenxiang / Install NVIDIA Driver and CUDA.md
Created August 7, 2020 02:42 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS