Skip to content

Instantly share code, notes, and snippets.

View tejashah88's full-sized avatar

Tejas Shah tejashah88

View GitHub Profile

ROS 2 - Calculator

Part 1 - Setting up service definitons

  1. Open a new terminal and source the workspace
cd ~/ros2_helloworld_ws
source install/local_setup.bash

ROS 2 - Hello World Part 2 - Mouse Sensor

  1. Open a new terminal and source the workspace
cd ~/ros2_helloworld_ws
source install/local_setup.bash
  1. Create a new package

Part 1 - Preparing the workspace

  1. Install needed tools
sudo apt install python3-colcon-common-extensions -y
sudo apt install python3-rosdep2 -y

# !!! NEW Needed Tools !!!
sudo apt install python3-pip
pip install setuptools==58.2.0

Set locale to UTF-8

sudo apt update && sudo apt install locales -y
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8

Update system

Create a new package

cd ~/ros2_ws/src
ros2 pkg create monitor_station --build-type ament_python --dependencies rclpy
code monitor_station/

Install extra dependencies

Part 1 - Preparing the project workspace

  1. Install needed tools
sudo apt install git -y
sudo apt install python3-colcon-common-extensions -y
sudo apt install python3-rosdep2 -y
  1. Create a new directory for your workspace and "change directory" (cd) to it in terminal
@tejashah88
tejashah88 / python-basic-rps-game.py
Created October 20, 2023 00:08
Basic rock-paper-scissors game
import random
CHOICES = ['R', 'P', 'S']
# Ask user for input (rock, paper, or scissors)
user_input = input('Rock, paper or scissors (type R, P, or S): ')
# Check if user input is valid
if user_input not in CHOICES:
print('Invalid choice')
@tejashah88
tejashah88 / deep-learn-gcp-setup.sh
Last active November 24, 2019 22:50
A bash script that's helpful for setting up your GCP Deep Learning VM instance to work with Google Colab. Recommended to be used in host and VM computers.
# Usage: install-python <VERSION>
# Example: install-python 3.6.9
function install_python() {
VERSION=$1
sudo apt install gcc make zlib1g-dev
sudo apt install libssl-dev # needed for SSL support
sudo apt install libsqlite3-dev # needed for SQLite support
sudo apt-get install libbz2-dev # needed for BZ2 compression support
wget "https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tar.xz"
@tejashah88
tejashah88 / install-python-scratch.sh
Last active November 24, 2019 22:50
Install python 3 from scratch. Helpful for upgrading python 3 version in GCP's Deep Learning VM.
VERSION=$1
sudo apt install gcc make zlib1g-dev
sudo apt install libssl-dev # needed for SSL support
sudo apt install libsqlite3-dev # needed for SQLite support
sudo apt-get install libbz2-dev # needed for BZ2 compression support
wget "https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tar.xz"
tar xJf "Python-$VERSION.tar.xz"
cd "Python-$VERSION"