Skip to content

Instantly share code, notes, and snippets.

View JeroenDM's full-sized avatar

Jeroen JeroenDM

  • KU Leuven
  • Belgium
View GitHub Profile
@JeroenDM
JeroenDM / read_file.cpp
Created January 12, 2018 10:08
I always forget how to read files with numbers in c++.
void read_file(std::string filename) {
// open file
std::ifstream infile(filename);
// check if opened succesfull
if (!infile) std::cout << "Failed to open file." << std::endl;
// read line by line and save in temporary string "line"
std::string line;
while(infile) {
% Uses the robotics toolbox from Peter I, Corke
% http://www.petercorke.com
% Robot model from the classic Puma 560
% https://en.wikipedia.org/wiki/Programmable_Universal_Machine_for_Assembly
% video on youtube: https://www.youtube.com/watch?v=uSICxNwDfn0&feature=youtu.be
% Calculate inverse kinematics for a given cartesion path
Ta = transl(-0.2, 0, 0.2) * angvec2tr(pi / 4, [0 1 0]) * transl(0.5, -0.5, 0.5); % define the start point
Tb = angvec2tr(pi / 4, [0 1 0]) * transl(0.5, -0.5, 0.5);
@JeroenDM
JeroenDM / callback_example.cpp
Created May 17, 2017 18:54
Test Boost.Function to implement a private callback function in a class
#include <iostream>
#include <boost/function.hpp>
#include <vector>
using namespace std;
// Simple Point class
class Point
{
int _value;
@JeroenDM
JeroenDM / task.json
Created May 11, 2017 15:50
The task settings I use for cpp programming in vscode. Build with ctrl+shift+b and run with F8. Based on several tutorials out there when googling vscode c++ tasks.
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"tasks": [
{
"taskName": "build",
"command": "g++",
"isShellCommand": true,
"isBuildCommand": true,