Sunday, September 27, 2020

Regex - Cheatsheet

 Character classes
.               any character except newline
\w \d \s        word, digit, whitespace
\W \D \S        not word, digit, whitespace
[abc]           any of a, b, or c
[^abc]          not a, b, or c
[a-g]           character between a & g


^abc$           start / end of the string
\b \B           word, not-word boundary

Escaped characters

\. \* \\        escaped special characters
\t \n \r        tab, linefeed, carriage return

Groups & Lookaround

(abc)           capture group
\1              backreference to group #1
(?:abc)         non-capturing group
(?=abc)         positive lookahead
(?!abc)         negative lookahead

Quantifiers & Alternation

a* a+ a?        0 or more, 1 or more, 0 or 1
a{5} a{2,}      exactly five, two or more
a{1,3}          between one & three
a+? a{2,}?      match as few as possible
ab|cd           match ab or cd


Thursday, May 7, 2020

ROS In Docker Container

ROS (Robot Operating System) - Documentation -

In this example I use docker image of ROS Melodic and a Dockerfile for creating the required docker container. Python3 (python3.7) is also installed in this example. 

Please refer for more information on Dockers.

(1) Pull the docker image for ROS Melodic

    docker pull ros:melodic

(2) Creating the Dockerfile

FROM ros:melodic
RUN apt-get update && apt-get upgrade -y \
    && apt-get install -y software-properties-common \
    && add-apt-repository ppa:deadsnakes/ppa \
    && apt-get install -y python3.7

RUN apt-get update && apt-get install -y \
    python-pip \
    python3-pip \
RUN apt-get install -y \
RUN apt-get update --fix-missing
RUN dpkg --configure -a
RUN apt-get install -f
RUN apt-get install -y \
    ros-melodic-desktop-full --fix-missing
RUN apt-get install -y python-catkin-tools
RUN apt-get install --no-install-recommends --no-install-suggests -y \
    build-essential \
    cmake \    
    python3.7-dev \
    && rm -rf /var/lib/apt/lists/*
RUN python -m pip install --upgrade pip
RUN python2 -m pip install --upgrade pip
RUN python3 -m pip install --upgrade pip
RUN pip3 install --upgrade pip
RUN pip3 install --upgrade setuptools
RUN python3.7 -m pip install --upgrade pip
RUN python3.7 -m pip install --upgrade setuptools

(3) Now create the docker using this Dockerfile and run 😊 (Refer documentation for more information)

Working With Python 3 In ROS Kinetic Or Melodic

ROS (Robot Operating System) - Documentation -

The Robot Operating System (ROS) is a flexible framework for writing robot software. It is a collection of tools, libraries, and conventions that aim to simplify the task of creating complex and robust robot behavior across a wide variety of robotic platforms. (Ref.

ROS (upto Melodic) officially supports only python2 and NOT python3. However some libraries we use in our projects (eg. Speech Recognition using Google Cloud Speech) may require python3 to run.

If ROS needs to support python3 we may have to recompile ROS source code using python3 which is not practical.

So what we can do is to run python3 programs, separately and connect using ROS bridge. (if we use custom messages (ROS msg)

However, if we are not using any custom rosmsg and using only built-in rosmsg, we can do the following steps to run python3 codes in ROS (without using a ROS bridge.)

Install ROS (here I install Melodic)
     apt install ros-melodic-desktop-full

After installing ROS, install rospkg for python3
     apt install python3-pip python3-all-dev python3-rospkg

This will prompt to install python3-rospkg and to remove ROS packages (already installed). Select Yes for that prompt. This will remove ROS packages and we will have to re-install them.
     apt install ros-melodic-desktop-full --fix-missing

This will complete the installation part. Now comes the coding part.

Just include the following directive as the first line of your program code (file) which should be executed using python3.
     #!/usr/bin/env python3

We can now execute everything as we do normally in ROS. 
Read the documentation (link is given above) for more information on ROS. 

Monday, October 28, 2019

Biped Walking Robot

We, a team of 3, attended a course titled "2 Mechatronics Project" conducted by Skyfi Labs in the month of October 2019. 
Thought of sharing the assignments done as a part of the course.

Biped Walking Robot

Robotic Arm

We, a team of 3, attended a course titled "2 Mechatronics Project" conducted by Skyfi Labs in the month of October 2019. 
Thought of sharing the assignments done as a part of the course.

Robotic Arm

Contact Form


Email *

Message *