Skip to content

Instantly share code, notes, and snippets.

View Kyungpyo-Kim's full-sized avatar
😁

Kyungpyo Kim Kyungpyo-Kim

😁
View GitHub Profile
@Kyungpyo-Kim
Kyungpyo-Kim / example_savePCDFile.cpp
Created April 27, 2018 13:34
[PCL][ROS] savePCDFile
#include <pcl/io/pcd_io.h>
bool Cluster::SaveCluster2Obj(int num)
{
char char_filename[80];
sprintf (char_filename, "/home/kyungpyo/pcd_dataset/PCD%06d.pcd" , num);
std::string str_filename (char_filename);
@Kyungpyo-Kim
Kyungpyo-Kim / recursive_preorder_traversal.cpp
Last active April 29, 2018 15:30
Algotithm, Binary tree, preorder search (recursive)
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
@Kyungpyo-Kim
Kyungpyo-Kim / iterative_preorder_traversal.cpp
Last active May 1, 2018 14:13
Algorithm, Binary tree searching, Iterative preorder traversal
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
@Kyungpyo-Kim
Kyungpyo-Kim / cloud_cb.cpp
Created April 30, 2018 06:07
PCL, ROS, sensor_msgs::PointCloud2 to PCL type
#include <pcl_conversions/pcl_conversions.h>
#include <pcl/point_types.h>
#include <pcl/PCLPointCloud2.h>
#include <pcl/conversions.h>
#include <pcl_ros/transforms.h>
void cloud_cb(const boost::shared_ptr<const sensor_msgs::PointCloud2>& input){
pcl::PCLPointCloud2 pcl_pc2;
pcl_conversions::toPCL(*input,pcl_pc2);
@Kyungpyo-Kim
Kyungpyo-Kim / pcl_to_ros.cpp
Created April 30, 2018 11:34
PCL, ROS, pcl to ros msg
void loam_wrapper::publishInput(pcl::PointCloud<pcl::PointXYZHSV>::Ptr pc)
{
sensor_msgs::PointCloud2 pc2;
pcl::toROSMsg(*pc, pc2);
pc2.header.stamp = ros::Time().now();
pc2.header.frame_id = "/world";
publishInput(pc2);
}
/* Reference
@Kyungpyo-Kim
Kyungpyo-Kim / pcl_calibaration.cpp
Last active May 1, 2018 07:20
PCL, calibration, transformation
// calibaration
Eigen::Affine3f PCLTransformationMat(float x, float y, float z, float roll, float pitch, float yaw)
{
Eigen::Affine3f transformation;
transformation.setIdentity();
Eigen::AngleAxisf rollAngle(roll, Eigen::Vector3f::UnitX());
Eigen::AngleAxisf pitchAngle(pitch, Eigen::Vector3f::UnitY());
Eigen::AngleAxisf yawAngle(yaw, Eigen::Vector3f::UnitZ());
Eigen::Quaternion<float> q = rollAngle*pitchAngle*yawAngle;
#include <pcl/filters/random_sample.h>
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_;
pcl::PointCloud<pcl::PointXYZRGB>::Ptr track_cloud(new pcl::PointCloud<pcl::PointXYZRGB>);
pcl::RandomSample <pcl::PointXYZRGB> random;
random.setInputCloud(cloud_);
random.setSeed (std::rand ());
random.setSample((unsigned int)(100));
@Kyungpyo-Kim
Kyungpyo-Kim / iterative_inoder_traversal.cpp
Created May 2, 2018 14:14
Binary Tree Inorder Traversal
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
@Kyungpyo-Kim
Kyungpyo-Kim / iterative_postorder_traversal.cpp
Created May 2, 2018 15:40
Binary Tree Postorder Traversal
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
@Kyungpyo-Kim
Kyungpyo-Kim / webots_simulation_setup.md
Last active May 10, 2018 07:16
Webots simulator installation, JOSM installation