Skip to content

Instantly share code, notes, and snippets.

View gonzaloruizdevilla's full-sized avatar

Gonzalo Ruiz de Villa gonzaloruizdevilla

  • GFT
  • Madrid, Spain
View GitHub Profile
npm install
npm run asbuild
@gonzaloruizdevilla
gonzaloruizdevilla / hybrid_breadth_first.cpp
Created February 23, 2019 12:32
Implement Hybrid A* in C++
#include <math.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include "hybrid_breadth_first.h"
// Initializes HBF
HBF::HBF() {}
HBF::~HBF() {}
@gonzaloruizdevilla
gonzaloruizdevilla / Hybrid_A_star_Pseudocode.py
Last active February 23, 2019 10:12
Hybrid A* Pseudocode
def expand(state, goal):
next_states = []
for delta in range(-35, 40, 5):
# Create a trajectory with delta as the steering angle using the bicycle model:
# ---Begin bicycle model---
delta_rad = deg_to_rad(delta)
omega = SPEED/LENGTH * tan(delta_rad)
next_x = state.x + SPEED * cos(theta)
next_y = state.y + SPEED * sin(theta)
#include "classifier.h"
#include <math.h>
#include <string>
#include <vector>
#include <iostream>
using Eigen::ArrayXd;
using std::string;
using std::vector;
@gonzaloruizdevilla
gonzaloruizdevilla / Left_Turn_Policy.py
Created February 18, 2019 17:23
Left Turn Policy
# ----------
# User Instructions:
#
# Implement the function optimum_policy2D below.
#
# You are given a car in grid with initial state
# init. Your task is to compute and return the car's
# optimal path to the position specified in goal;
# the costs for each motion are as defined in cost.
#
@gonzaloruizdevilla
gonzaloruizdevilla / main.cpp
Created February 14, 2019 18:44
Particle Weights Solution
#include <iostream>
#include "multiv_gauss.h"
int main() {
// define inputs
double sig_x, sig_y, x_obs, y_obs, mu_x, mu_y;
// define outputs for observations
double weight1, weight2, weight3;
// final weight
double final_weight;
# Now we want to simulate robot
# motion with our particles.
# Each particle should turn by 0.1
# and then move by 5.
#
#
# Don't modify the code below. Please enter
# your code at the bottom.
from math import *
@gonzaloruizdevilla
gonzaloruizdevilla / robot.py
Created February 13, 2019 14:25
RobotNoise
# Now add noise to your robot as follows:
# forward_noise = 5.0, turn_noise = 0.1,
# sense_noise = 5.0.
#
# Once again, your robot starts at 30, 50,
# heading north (pi/2), then turns clockwise
# by pi/2, moves 15 meters, senses,
# then turns clockwise by pi/2 again, moves
# 10 m, then senses again.
#include <algorithm>
#include <iostream>
#include <vector>
#include "helpers.h"
using std::vector;
using std::cout;
using std::endl;
#include <algorithm>
#include <iostream>
#include <vector>
#include "helpers.h"
using std::vector;
// function to get pseudo ranges
vector<float> pseudo_range_estimator(vector<float> landmark_positions,