Skip to content

Instantly share code, notes, and snippets.

View tahsinkose's full-sized avatar
🖇️
ROS Advocate, RL researcher

Tahsincan Köse tahsinkose

🖇️
ROS Advocate, RL researcher
View GitHub Profile
@tahsinkose
tahsinkose / build_and_push.sh
Created May 19, 2022 18:20
Docker image building and pushing to ECR for SageMaker
#!/usr/bin/env bash
# This script shows how to build the Docker image and push it to ECR to be ready for use
# by SageMaker.
# There are 3 arguments in this script:
# - image - required, this will be used as the image on the local machine and combined with the account and region to form the repository name for ECR;
# - tag - optional, if provided, it will be used as ":tag" of your image; otherwise, ":latest" will be used;
# - Dockerfile - optional, if provided, then docker will try to build image from provided dockerfile (e.g. "Dockerfile.serving"); otherwise, default "Dcokerfile" will be used.
# Usage examples:
@tahsinkose
tahsinkose / er75_start_gazebo.launch
Created September 4, 2019 21:33
Starts Gazebo-specific ROS entities for ER75 robotic arm.
<?xml version="1.0"?>
<launch>
<arg name="paused" default="false"/>
<arg name="gazebo_gui" default="true"/>
<!-- startup simulated world -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" default="worlds/empty.world"/>
<arg name="paused" value="$(arg paused)"/>
<arg name="gui" value="$(arg gazebo_gui)"/>
@tahsinkose
tahsinkose / product_graph.py
Last active June 22, 2019 15:51
Python script that creates the product graph, which consists of pairs of identically labeled nodes and edges from G1 and G2.
import networkx as nx
import matplotlib.pyplot as plt
"""
Implements Product Graph operator proposed in https://sites.cs.ucsb.edu/~xyan/tutorial/GraphKernels.pdf.
"""
def product_graph(G1,G2):
G = nx.lexicographic_product(G1,G2)
PG = nx.Graph()
for n in G.nodes():
@tahsinkose
tahsinkose / gimbal.urdf.xacro
Created May 16, 2019 07:38
Gimbal URDF used in DJI M100 Gazebo Simulation.
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:macro name="dji_m100_gimbal">
<joint name="virtual_gimbal_joint" type="fixed">
<origin xyz="-0.1 0 -0.04" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="virtual_gimbal_link"/>
</joint>
<gazebo reference="virtual_gimbal_joint">
@tahsinkose
tahsinkose / raspberrytoolchain.cmake
Last active December 13, 2019 11:22
Toolchain file for Cross-Compilation from Linux to Raspberry Pi 3
#File raspberrytoolchain.cmake for ROS and system packages to cross compile.
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
# Below call is necessary to avoid non-RT problem.
SET(CMAKE_LIBRARY_ARCHITECTURE arm-linux-gnueabihf)
SET(RASPBERRY_ROOT_PATH ${CMAKE_CURRENT_LIST_DIR}/arm_raspberry)
@tahsinkose
tahsinkose / curses_flash.py
Created October 29, 2018 13:09
Multiple line flashing with curses library
import time
import curses
if __name__=="__main__":
stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
#include <iostream>
#define N 1000
/*
This is quite a good example of Template Meta Programming. Especially, in hackathons that accept executables or does not have
time limit in compilation, computation-heavy tasks as prime num discovery in a range can be hacked in compile time. And the result
can be expressed in O(1) or O(n) with some reasonable constant factor.
Reference: https://en.wikibooks.org/wiki/C%2B%2B_Programming/Templates/Template_Meta-Programming
*/
/*
Compile-time resolution of correct data type based on the platform differency. For example, if the code is compiled in a 32-bit machine,
integral_ptr_t is resolved into uint32_t. Reinterpreting the pointer, which is a void pointer, into uint32_t and dereferencing later back to, e.g. int*,
is a thorough valid operation. -> Refer to https://en.cppreference.com/w/cpp/language/reinterpret_cast for further information.
Reference: https://en.wikibooks.org/wiki/C%2B%2B_Programming/Templates/Template_Meta-Programming
*/
#include <iostream>
#include <cstdint>