Skip to content

Instantly share code, notes, and snippets.

import rosbag
from tf.msg import tfMessage
with rosbag.Bag('output.bag', 'w') as outbag:
for topic, msg, t in rosbag.Bag('input.bag').read_messages():
if topic == "/tf" and msg.transforms:
newList = [];
for m in msg.transforms:
if m.header.frame_id != "map":
newList.append(m)
else:
@matlabbe
matlabbe / gtsam_GKlib_android_fix.patch
Created March 20, 2017 18:33
GTSAM android patch
From 6a1c1cb56233bd4f990c72f9726167e774668d9d Mon Sep 17 00:00:00 2001
From: matlabbe <matlabbe@gmail.com>
Date: Mon, 20 Mar 2017 14:29:42 -0400
Subject: [PATCH] fixed metis/GKlib compilation errors for android
---
gtsam/3rdparty/metis/GKlib/GKlibSystem.cmake | 4 +++-
gtsam/3rdparty/metis/GKlib/error.c | 2 +-
gtsam/3rdparty/metis/GKlib/gk_externs.h | 1 -
gtsam/3rdparty/metis/GKlib/gk_macros.h | 2 +-
@matlabbe
matlabbe / rtabmap-0.16.3-euroc-tool-fix.patch
Created December 25, 2018 18:42
Patch to fix rtabmap 0.16.3 build of euroc tool on c++11
diff --git a/tools/EurocDataset/main.cpp b/tools/EurocDataset/main.cpp
index 26e633b..4e8a3d0 100644
--- a/tools/EurocDataset/main.cpp
+++ b/tools/EurocDataset/main.cpp
@@ -44,6 +44,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <yaml-cpp/yaml.h>
#include <stdio.h>
#include <signal.h>
+#include <fstream>
@matlabbe
matlabbe / orbslam2_f2e6f51_marchnative_disabled.patch
Created December 27, 2018 04:16
ORB_SLAM2 patch to disable -march=native
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 08a8af4..8190289 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,8 +7,8 @@ ENDIF()
MESSAGE("Build type: " ${CMAKE_BUILD_TYPE})
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")
@matlabbe
matlabbe / pointcloud_to_laserscan_nodelet_indigo.patch
Created January 26, 2019 01:59
Fixing pointcloud_to_laserscan build from indigo_devel branch into recent ros distros
diff --git a/src/pointcloud_to_laserscan_nodelet.cpp b/src/pointcloud_to_laserscan_nodelet.cpp
index 3411d45..5918f0b 100644
--- a/src/pointcloud_to_laserscan_nodelet.cpp
+++ b/src/pointcloud_to_laserscan_nodelet.cpp
@@ -238,4 +238,4 @@ namespace pointcloud_to_laserscan
}
-PLUGINLIB_DECLARE_CLASS(pointcloud_to_laserscan, PointCloudToLaserScanNodelet, pointcloud_to_laserscan::PointCloudToLaserScanNodelet, nodelet::Nodelet);
+PLUGINLIB_EXPORT_CLASS(pointcloud_to_laserscan::PointCloudToLaserScanNodelet, nodelet::Nodelet);
@matlabbe
matlabbe / okvis_1dce912_marchnative_disabled.patch
Last active March 20, 2019 16:48
OKVIS with -march=native disabled and use shared libraries
diff --git a/.gitignore b/.gitignore
index 7ee7366..f764f90 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,3 +29,5 @@
# Docu
documentation/html/
+
+build
@matlabbe
matlabbe / tum_rename_world_kinect_frame.py
Created March 20, 2019 20:35
Script used to rename /world -> /kinect frame to /world -> /kinect_gt to be more friendly with SLAM approaches that estimate /map -> /kinect
import rosbag
import sys
import os
from tf.msg import tfMessage
if len(sys.argv) < 1:
print 'Usage example: tum_rename_world_kinect_frame.py rgbd_dataset_freiburg3_long_office_household.bag'
exit
os.rename(sys.argv[1], sys.argv[1] + '.tmp')
@matlabbe
matlabbe / republish_tf_static.py
Last active January 27, 2020 23:44
Fix /tf_static not latched when replaying a rosbag (see https://answers.ros.org/question/207551/how-to-save-static-transforms-in-bag-files/?answer=207647#post-id-207647). Start this script before running a rosbag, then do: `rosbag play --clock tf_static:=tf_static_old`
#!/usr/bin/env python
import rospy
from tf2_msgs.msg import TFMessage
def callback(data):
rospy.loginfo("Received /tf_static_old and republising latched /tf_static")
pub.publish(data)
if __name__ == '__main__':
rospy.init_node('listener', anonymous=True)
@matlabbe
matlabbe / os1_fix.patch
Created March 2, 2020 19:52
Ouster fix to use host timestamp and imu gravity inverted
diff --git a/ouster_ros/src/os1_cloud_node.cpp b/ouster_ros/src/os1_cloud_node.cpp
index 8a7e8ec..964cfa6 100644
--- a/ouster_ros/src/os1_cloud_node.cpp
+++ b/ouster_ros/src/os1_cloud_node.cpp
@@ -59,6 +59,7 @@ int main(int argc, char** argv) {
[&](uint64_t scan_ts) mutable {
msg = ouster_ros::OS1::cloud_to_cloud_msg(
cloud, std::chrono::nanoseconds{scan_ts}, lidar_frame);
+ msg.header.stamp = ros::Time::now();
lidar_pub.publish(msg);
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3279915..f007cff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -155,8 +155,8 @@ endif(WIN32)
add_subdirectory( cmake )
add_subdirectory( src )
-add_subdirectory( examples )
-add_subdirectory( test )