Skip to content

Instantly share code, notes, and snippets.

@vhwanger
vhwanger / gist:5321740
Last active December 15, 2015 20:49
navigation snippet
// simulate sensing the cells
for (int i = 0; i < (int)sensecells.size(); i++) {
int x = CONTXY2DISC(startx, cellsize_m) + sensecells.at(i).x;
int y = CONTXY2DISC(starty, cellsize_m) + sensecells.at(i).y;
// ignore if outside the map
if (x < 0 || x >= size_x || y < 0 || y >= size_y) {
continue;
}
int index = x + y * size_x;
@vhwanger
vhwanger / visualize.py
Last active December 15, 2015 18:38
Plots a planned path against the map.
"""
Plots paths outputted from the xytheta example.
Usage:
$ python visualize.py [cfg file] [solution file]
"""
import sys
import re
import numpy as np
@vhwanger
vhwanger / xytheta.cpp
Last active November 17, 2017 09:04
SBPL example
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
#include <sbpl/headers.h>
// creating the footprint
void createFootprint(vector<sbpl_2Dpt_t>& perimeter){
@vhwanger
vhwanger / xytheta.cpp
Last active December 15, 2015 17:38
Setting up an environment for X, Y, Theta state space
void planxythetalat(char* envCfgFilename, char* motPrimFilename){
// set the perimeter of the robot
vector<sbpl_2Dpt_t> perimeter;
createFootprint(perimeter);
// initialize an environment
EnvironmentNAVXYTHETALAT env;
initializeEnv(env, perimeter, envCfgFilename, motPrimFilename);
// specify a start and goal state