Skip to content

Instantly share code, notes, and snippets.

View RobinCPC's full-sized avatar

Robin Chen RobinCPC

View GitHub Profile
@RobinCPC
RobinCPC / STL translation for ROS.md
Last active April 11, 2016 10:21
record how to create URDF from PMC step file

[ROS] How to transform PMC robot step file to STL for rviz

  1. load step to solidworks
  2. move joint rotation center to the origin of world
    • moving distance may depend on DH table
    • ROS will move parts to desired position according ot URDF file
  3. select needed parts (each joint may contain a lot of small part: screw or plate)
  4. save as... STL
  5. in advance option:
@RobinCPC
RobinCPC / OpenCV Install steps.MD
Last active February 25, 2016 07:06
This file contain steps of install OpenCV 3.10 (personal VM ros hydro 12)

OpenCV install command list:

Intall OpenCV 3.1 in Ubuntu 12.04 LTS

  1. KEEP UBUNTU OR DEBIAN UP TO DATE

Open your terminal and execute:

$ sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove
@RobinCPC
RobinCPC / gvim-load-slow.md
Last active November 14, 2015 22:16
fix gvim loading slow

If run gvim in terminal. When gvim is loading slow and show following message:

** (gvim:20320): WARNING **: Unable to create Ubuntu Menu Proxy: Timeout was reached

Solution 1: Make the global menu for gvim work

To get global menu for gvim and to get rid of the warning message, add this to ~/.bashrc and restart the terminal:

function gvim () { (/usr/bin/gvim -f "$@" &) }
@RobinCPC
RobinCPC / power-font-ins.txt
Created November 14, 2015 21:07
Install powerline font to ubuntu system
# under $HOME
mkdir .fonts/ # if .fonts directory not exist
cd .fonts/
git clone https://github.com/powerline/fonts.git
cd fonts/
./install.sh
@RobinCPC
RobinCPC / Variadic_function_Messag_demo.cpp
Last active August 29, 2015 14:21
Add a (Variadic function) to send message from realtime controller to HMI
void PMC_SendCtrlMsg(MSG_TYPE Type, char Text[256], ...); // variadic function Delcaration
void PMC_SendCtrlMsg(MSG_TYPE Type, char Text[256], ...) // variadic function Definetion
{
MsgQueue[MsgQueueIndex+1].rtMsgType = Type;
//get final string according to parameters
char temp_text[256];
sprintf(temp_text, Text);
@RobinCPC
RobinCPC / random declare variable.py
Created February 19, 2014 17:31
random declare variable and avoid variable over number range (e. g. keep angle in 0~ 2 pi)
#
from math import *
import random
N = 1000
index = int(random.random() * N) # randomly pick a starting index
for i in range(N):
index = (index + 1) % N # keep index in side 0~1000
@RobinCPC
RobinCPC / warning_method.py
Last active August 29, 2015 13:56
how to make a warning to user if they input inappropriate value
#Using "raise" in python to warning user
def set(self, new_x, new_y, new_orientation):
if new_x < 0 or new_x >= world_size:
raise ValueError, 'X coordinate out of bound'
if new_y < 0 or new_y >= world_size:
raise ValueError, 'Y coordinate out of bound'
if new_orientation < 0 or new_orientation >= 2 * pi:
raise ValueError, 'Orientation must be in [0..2pi]'
self.x = float(new_x)
@RobinCPC
RobinCPC / Measuring_Performance.cpp
Last active January 2, 2016 11:29
Calculate computing time
//Measuring performance of function more precisively.
// Include necessary file
#include <windows.h>
// Add code to calculate the computing time of function more precsively
LARGE_INTEGER nFreq;
LARGE_INTEGER nBeginTime;
LARGE_INTEGER nEndTime;
double computing_time;
QueryPerformanceFrequency(&nFreq);