Skip to content

Instantly share code, notes, and snippets.

View johannah's full-sized avatar

Johanna Hansen johannah

View GitHub Profile
@johannah
johannah / pain_model.py
Last active June 5, 2019 20:38
ai4good pain model example
import numpy as np
import os
import sys
# hours_per_time_step should be greater than 1
hours_per_step = 2
class PainModel():
def __init__(self, seed):
# pain -1 is bad
'''
This script saves each topic in a bagfile as a csv.
Accepts a filename as an optional argument. Operates on all bagfiles in current directory if no argument provided
Originally Written by Nick Speal in May 2013 at McGill University's Aerospace Mechatronics Laboratory
Modified by J.Hansen in 2021
'''
import rosbag, sys, csv
# to get mujoco-py to install with headless rendering without sudo access
##############################
# 1) first download and install mujoco according to instructions from https://github.com/deepmind/mujoco/
##############################
# 2) add environment variables to your bashrc
# importantly, this should be done before installing mujoco-py
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/$USER/.mujoco/mujoco210/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia