Showing posts with label Robotics. Show all posts
Showing posts with label Robotics. Show all posts

Tuesday, 4 December 2018

[2018: Internship at CSIRO] Developing an End to End Pipeline for Machine Learning in Robotics

The Internship

In May 2018, I was chosen for a 6 month paid internship program at DATA61 CSIRO (The national science agency of Australia), in Brisbane, Australia. I was supervised by Nicholas Hudson (who previously worked as a Senior Roboticist in NASA Jet Propulsion Laboratory, Boston Dynamics and Google) and Dr. Navinda Kottege.

The main task assigned to me was to develop an end-to-end pipeline for robotics-related machine learning for future use in DATA61 CSIRO and demonstrate it by extending NVIDIA's trailnet (Resnet-18 based) neural network for autonomous navigation of indoor hallways and hill-climbing. For this I did the following tasks:

  1. Built (with a partner) a 6-wheeled robot platform for data collection
  2. Collected data (with a partner) into ROS bags
  3. Wrote scripts to convert ROSbags into TF records on Bracewell (CSIRO's supercomputer)
    I needed to modify and build custom singularity docker containers to run this.
  4. Create a 20-layer residual convolutional neural network with both Keras-Tensorflow and pure Tensorflow.
  5. Build a pipeline to thoroughly and efficiently shuffle and prefetch data from TF records and train the model.
  6. Optimize the trained model for embedded devices (Jetson TX2) with TensorRT (both pure C++ and python tf-trt)
  7. Implement the inference engines as ROS nodes (C++ and python both)
  8. Modify the motor controller ROS package of Roboclaw to avoid thread racing and deadlock issues and make the robot autonomously navigate hallways
  9. Build models for hill climbing and experiment with them.


Following is a presentation I did to the audience of scientists from Robotics and Automation Group, DATA61, CSIRO about my pipeline.




Hallway Navigation





Sunday, 10 December 2017

[2017] Bidirectional Maze Solver: Pointer manipulation for flipping, Computer Vision ideas


In November 2017, I formed a group with 3 others to compete in Sri Lanka Robotics Challenge 2017 (to be held on January 2018). According to the task, the two teams must produce two robots each, one stationary and one mobile, which should coordinate via any wireless method to complete the task.



My Responsibilities

I was appointed the group leader and also I took the responsibility of designing and coding the mobile robot, which is a line maze solver. I also refined the concept and made final design of the stationary robot (which should be able to shoot a ball turning 360 degrees in horizontal plane and to about 10 degrees in vertical plane).



The Mobile Robot: Innovative Ideas

Since the task of mobile robot is relatively easy to perform, I realized the key for winning is the speed. When I considered different ways to reduce the time taken, I noted two factors:


  1. The robot takes some time to make a U-turn at nodes of the maze. Also, a U-turn is dangerous as since the sensor panel moves completely out of the line, there is a chance the robot might get disoriented.
  2. By traditional always-take-left algorithm, the robot visits empty nodes (where boxes are not kept), wasting time.

1. Bidirectionality: Eliminating U Turns

I proposed the idea to make the robot fully bidirectional. While increasing the cost, this needed some redesign of the body from traditional designs and the need for some innovative methods to be used in coding.


a) C pointers and OOP programming for bidirectionality

I have learnt the wonders of pointer & reference manipulations in C++ language and I have learnt OOP concepts through Java & PHP programming. I decided to combine them as a solution.

As shown below, I made classes for motors and created objects for each motor, sonar, IR panel and color detector. Then I defined references *pMotorLF, *pMotorLR...etc for front left, front right...etc motors from the POV of the robot. The rest of the code would be written in terms of the pointers, not of the objects themselves. 


eg: pMotorLF->drive(-100)

Using a custom flip function I could change the objects to which the reference is pointing to and this would effectively flip the entire robot internally.

A function definition for the motor class.

Flip function definition. Calling this function would immediately software-flip the robot by 180 degrees


b) Hardware issues & solutions

Due to bidirectionality, we decided to place the relatively expensive main line sensor panel (8-qtr) at the exact center of the robot. This has the disadvantage that the the small lag between sensing and acting would make the robot act too late and veer off the line. It was solved by (c)


2. Variable Speeds & variable PID constants


To solve this, I came up with the idea of using two sets of speed configurations. I proposed that we could use a relatively cheap 3-qtr at exact center of each front and back lines. 
  • If the robot senses a line on the front 3-qtr, he assumes a a higher speed and the PID constants associated (and tuned) with respect to that speed. 
  • If not, robot assumes a lower speed and associated PID constants.
Using this method, the robot moves at high speeds along straight lines and at lower speeds near junctions and curvy lines, reducing the error.


3. Loophole in the rules - Workaround for hard coding


According to the task, few nodes of the maze graph are left empty, without any boxes. A traditional take-left robot would visit them, wasting time. The solution would be to hard code the maze, but according to rules, the positions of the boxes are changed in every round and hard coding is a crime. 

As a workaround, I proposed the idea of manually inputting the maze using buttons before the round (which was not restricted, a loophole). I wrote an algorithms to always take left, but avoid the i-th left, where i is a member of an array (where  the turns to be avoided are stored). The array is initialized empty and it can be filled by pressing buttons on top of the robot. 

Before a round, when the boxes are placed, I would take down the turns that need to be avoided and press buttons according to the programmed protocol to fill the array with those numbers. The robot would then simply avoid those turns, saving time.



Ideas on Computer Vision


To avoid empty nodes, I also proposed a solution with machine vision. By that time, we were taking a module: "Fundamentals of Image Processing and Computer Vision" and I had some experience with image processing methods. 
I proposed, we could 
  • Mount a camera module on the stationary bot (then the view and the projective transformation is known in advance)
  • Apply projective transform, crop to the arena and get ImIn
  • Skeletonize the thresholded ImIn to get the path
  • Finding unique blobs in the R,G,B layers separately to identify boxes
  • Using array navigation to find which nodes to be avoided
  • Transmit an array full of "turns to be avoided" to the mobile robot
I proposed the above to Kanchana, my colleague who is actively researching in computer vision field and he agreed to join our team.


Project Discontinued

The group was highly active and as I wrote the algorithms, rest of the group started to build the prototypes for the robot. However, due to academic workload, the hardware guy in the group decided to quit. He needed to focus on the web development project which we needed to do for another module. Without a hardware guy, I could not continue this and finish it before deadline. Therefore, sadly the project was abandoned.



Github Repository






Sunday, 20 August 2017

[2017] Ring Finding Robot: with GPS following, obstacle avoiding, wall following, color detection, parallel alignment, robotic arm manipulation capabilities



Through this project we built Gollum, an outdoor mobile robot to perform GPS following, obstacle avoiding, wall following, color detection, parallel alignment and robotic arm manipulation.

I was responsible for designing the algorithm and programming the robot (1,200 lines of code)

Task:


The robot starts from within the starting circle of 1m in radius. Out of three pre-defined target locations, one location is chosen at random and give to us in the start. We input the target location using a keypad/set of 3 switches. The robot should the follow GPS and visit the target, which is 20m away. On the way, there is a "forest" of obstracles (30 cm cubes) which the robot should avoid. Target is marked by a circle of white line (3cm thickness) 2m in radius around the target point.

At the target point, lies a cylindar, 50cm in radius. The cyclindar has 40 cm wide entrance on one side.The robot should find the cylindar, move to meet it, follow the wall around it, find the entrance, move in. Inside the cylindar lies a 5 cm high, 40cm diameter plate that contains a metal ring og 6cm diameter anywhere in it. The robot should be able to search and pick up the ring with an arm.

Then then robot should return to the starting location and stop.

GitHub Repository:

https://github.com/abarajithan11/gollum_ring_finder


Behind the Scenes:

I took Gollum to one of my basic robotics workshop as an inspiration. Some school students mishandled him, he fell down and the perspex body was broken in half.

I had to bandage him with a piece of cloth to bring him back.

Reprogramming the parameters for the new version

Rebuilding gollum's body. This time with a cool black sticker

Bending perspex with a high current precision heating device


The mess of wires... need to be sorted.

Samith's boarding room. The hardware workshop.




Monday, 27 February 2017

[2017] Dobbybot: A Battlebot under $32

Dobbybot in the hands of our skillful driver: Praga
For a battlebot competition, we decided to build a bot under 30$. Clad in stainless steel plates for armour and a flipper arm powered by 12 kgcm servo motors, production cost was 32$. 

The Design


I was responsible for structural design. I made multiple mechanical designs and finally used my 3-wedge sided, very low profile (7 cm high) version. The robot competed with other robots that cost 300$ and won the 3rd place. My wedged design with low center of gravity and almost zero ground clearance was commended for its uniqueness and novelty by the judging panel.

The frame of the robot

Scaled drawing of how the parts fit together


Making


We took the robot 100 km away from the university, to the hometown of Chinthana for welding. We got the stainless steel plate free from his relative.








 Designs and Documents