Skip to content

Instantly share code, notes, and snippets.

@cedrusx
cedrusx / unite_imu_topics.py
Created September 13, 2020 03:35
This script merges the accel and gyro topics into a united imu topic for given ROS bags from the OpenLORIS-Scene datasets
#!/usr/bin/env python2
"""
merge accel and gyro message into one IMU topic in the given bag
"""
import rosbag
import sys
from sensor_msgs.msg import Imu
def main():
files = sys.argv[1:]
@cedrusx
cedrusx / get_data_from_xls.py
Last active June 20, 2020 09:05
Python code to fetch data from Excel spreadsheets
def get_data_from_xls(filename, column_letters=(), column_titles=()):
"""
Fetch data in given columns from a xls/xlsx file
Specify columns either by letters (e.g. ('A', 'B', 'AE')) or by titles in the first row
Return a list of dict, with the given letters or titles as keys
"""
wb = load_workbook(filename='data.xlsx')
sheetname = wb.sheetnames[0] # assume first sheet in the workbook
sheet = wb[sheetname]
print('Reading %s in %s' % (sheetname, filename))