This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool | |
compare (int idx1, int idx2) const | |
{ | |
bool dist_ok; | |
if(this->depth_dependent_) | |
{ | |
Eigen::Vector3f vec = input_->points[idx1].getVector3fMap (); | |
float z = vec.dot (this->z_axis_); | |
dist_ok = (fabs ((*plane_coeff_d_)[idx1] - (*plane_coeff_d_)[idx2]) < distance_threshold_ * z * z); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example color list: | |
c = """#e41a1c | |
#377eb8 | |
#4daf4a | |
#984ea3 | |
#ff7f00 | |
#ffff33 | |
#a65628 | |
#f781bf | |
#999999""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <camera_info_manager/camera_info_manager.h> | |
ros::NodeHandle nh("~"); | |
camera_info_manager::CameraInfoManager mgr(nh); | |
mgr.setCameraName("camera"); | |
mgr.loadCameraInfo("file://my/camera_info.yaml"); | |
sensor_msgs::CameraInfo info = mgr.getCameraInfo(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Eigen/Geometry> | |
int main(int argc, char** argv) | |
{ | |
Eigen::Quaterniond q1(0, 0, 0, 1.); | |
Eigen::Vector3d t1(1., 0, 1.); | |
Eigen::Vector3d p1 = q1*Eigen::Vector3d(0,0,0) + t1; | |
//Isometry if only rotation and translation components | |
Eigen::Isometry3d tf = Eigen::Translation3d(t1) * q1; | |
Eigen::Affine3d tf_affine = tf; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from collections import defaultdict, deque | |
INVALID = "Invalid" | |
class Record(object): | |
SOUND = "neigh" | |
def __init__(self): | |
self._next = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <string> | |
#include <vector> | |
/* | |
* Rotate square matrix by 90 deg clock wise. | |
*/ | |
template<typename T> | |
bool rotateMatrix(std::vector< std::vector<T> >& mat) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import json | |
import requests | |
import click | |
def read_description(url): | |
"""Read json from url. | |
:param url: url to access |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <functional> | |
#include <vector> | |
#include <unordered_map> | |
std::vector<std::string> split(const std::string& value, char delim) | |
{ | |
std::vector<std::string> res; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import tf.transformations as tft | |
def quat_to_array(msg): | |
return np.array([msg.x, msg.y, msg.z, msg.w]) | |
def vec_to_array(msg): | |
return np.array([msg.x, msg.y, msg.z]) | |
def from_pose_msg(msg): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f1 = lambda x: 1./np.exp(0.1*(x + 80.)) | |
f2 = lambda x: -.26*(x+58) | |
def weight(i, fs): | |
return lambda x: np.exp(fs[i](x)) / np.sum([np.exp(f(x)) for f in fs]) | |
def softmax(fs): | |
return lambda x: np.sum([f(x)*weight(i,fs)(x) for i,f in enumerate(fs)]) | |
softmax([f1,f2])(np.linspace(-80,0)) |
OlderNewer