Skip to content

Instantly share code, notes, and snippets.

View olegsinavski's full-sized avatar

Oleg Sinavski olegsinavski

View GitHub Profile
#define REQUIRE( ... ) \
do { \
if( !( __VA_ARGS__ ) ) { \
std::stringstream ss; \
ss << "Unit test assert [ " \
<< ( #__VA_ARGS__ ) \
<< " ] failed in line [ " \
<< __LINE__ \
<< " ] file [ " \
<< __FILE__ << " ]" \
@olegsinavski
olegsinavski / gist:502af97928c26b28f6ec45ed7c305904
Created November 26, 2019 18:09
Profile numpy version onliner array 180
import numpy as np
from shining_software.utilities.profiling_utils import profiler
print(np.__version__)
with profiler(enable=True):
size = 180
for i in range(1000000):
@olegsinavski
olegsinavski / gist:51a293fcb05ad03004e6d3e50113cb5e
Last active November 8, 2019 18:21
Compile opencv 3.3.1 on tx2
#!/usr/bin/env bash
echo "Install requirement"
# sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
# sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
# sudo apt-get install libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
# sudo apt-get install libv4l-dev v4l-utils qv4l2 v4l2ucp
# sudo apt-get install -y curl
# sudo apt-get update
@olegsinavski
olegsinavski / gist:291fe311854f2870a180c8fb765eb891
Created January 4, 2019 22:50
Run RL wtih openai baselines
import baselines.common.cmd_util as butils
import baselines.ppo2.ppo2 as ppo
import gym
import bc_gym_planning_env
if __name__ == '__main__':
# https://github.com/openai/baselines
env = butils.make_vec_env(
env_id='EgoCostmapAsImgRandomTurnRoboPlanning-v0',
env_type='robo_planning',
@olegsinavski
olegsinavski / gist:5f01dd05ff767053d289b2cba3d2da41
Created December 18, 2018 00:10
Fleet analysis of odometry problems
Warning sessions
57770331-90fe-4bd6-aadf-b13085e25a7b_session_v12.tar.xz machine=8ec18dee-f3d4-491d-b92b-aa99ed54bf1e [OdometryQualityCode.MANY_GYRO_ENCODER_ERRORS: Error ratio: 0.31%] dur=30min env=offices comment:Ok (office)
529d95da-b905-4a01-993b-a7576b9b6617_session_v14.tar.xz machine=dc6312a7-2ede-4a21-8416-922b5fd75ad7 [OdometryQualityCode.STEERING_ENCODER_JUMPS: Steering encoder jumps or is stuck (16x)] dur=46min env=wallmart comment:Ok (large one shot)
afa85daa-b898-483a-82ec-218bf91bbbd8_session_v11.tar.xz machine=8d437ff1-a099-4d2f-b5db-0544dc56309c [OdometryQualityCode.MANY_GYRO_ENCODER_ERRORS: Error ratio: 0.24%] dur=29min env=wallmart comment:Ok (warehouse)
3de1f842-b341-495e-a87d-5f186e601922_session_v12.tar.xz machine=4e8c725b-3499-4792-aac3-5d54a0f4c3a6 [OdometryQualityCode.LARGE_GYRO_NOISE: Large noise in gyro (6x)] dur=13min env=simon_malls comment:Ok
ef835a33-55c9-4abc-89dc-7343b51d88b9_session_v15.tar.xz machine=UNKNOWN [OdometryQualityCode.LARGE_TRANSIENT_ENCODER_BIAS: Large transient bi
@olegsinavski
olegsinavski / webpage_sample.py
Created November 7, 2018 22:39
webpage_sample
# Perform sensory fusion and generate 3d obstacle map using depth, RGB cameras, lidars
# and SLAM outputs
obstacle_signals = self._costmap_generator.generate_costmap(
planar_scans=layer_observations.planar_scans,
voxel_scans=layer_observations.voxel_scans,
depth_observations=layer_observations.depth_observations,
point_cloud_observations=layer_observations.point_cloud_observations,
camera_observations=layer_observations.camera_observations,
robot_state_observations=layer_observations.robot_state_observations,
current_time=self._last_added_observation_timestamp,
filename = bc_artifacts.get(
key=pickled_file_key,
progress_callback=bc_artifacts.artifacts.indicate_download_progress,
bucket_name='shining-replay-data',
progress_callback_granularity=5)
filename = bc_artifacts.get(key=pickled_file_key, progress_callback=bc_artifacts.artifacts.indicate_download_progress, bucket_name='shining-replay-data', progress_callback_granularity=5)
@olegsinavski
olegsinavski / gist:05065a4f5fcf378312dbb1c567135049
Created July 11, 2017 23:41
Fit Student-t and normal distribution in python
import scipy
import scipy.stats
plt.hist(noise, bins=100, normed=1)
x = np.linspace(-0.2, 0.2, len(noise))
dist_names = ['norm', 't']
for dist_name in dist_names:
dist = getattr(scipy.stats, dist_name)
param = dist.fit(noise)
pdf_fitted = dist.pdf(x, *param[:-2], loc=param[-2], scale=param[-1])
@olegsinavski
olegsinavski / gist:6277816
Created August 20, 2013 06:42
ROS resource_retriever mac os build failure
==> Processing catkin package: 'resource_retriever'
==> Building with env: '/Users/olegsinyavskiy/ros_catkin_ws/install_isolated/env.sh'
Makefile exists, skipping explicit cmake invocation...
==> make cmake_check_build_system in '/Users/olegsinyavskiy/ros_catkin_ws/build_isolated/resource_retriever'
==> make -j4 -l4 in '/Users/olegsinyavskiy/ros_catkin_ws/build_isolated/resource_retriever'
Linking CXX shared library /Users/olegsinyavskiy/ros_catkin_ws/devel_isolated/resource_retriever/lib/libresource_retriever.dylib
ld: warning: ignoring file /Library/Frameworks//libcurl.framework/libcurl, missing required architecture x86_64 in file /Library/Frameworks//libcurl.framework/libcurl (2 slices)
Undefined symbols for architecture x86_64:
"_curl_easy_cleanup", referenced from:
resource_retriever::Retriever::~Retriever() in retriever.cpp.o