3

I'd like to improve my little robot with machine learning.

Up to now it uses simple while and if then decisions in its main function to act as a lawn mowing robot.

My idea is to use SKLearn for that purpose.

Please help me to find the right first steps.

i have a few sensors that tell about the world otside:

World ={yaw, pan, tilt, distance_to_front_obstacle, ground_color}

I have a state vector

State = {left_motor, right_motor, cutter_motor}

that controls the 3 actors of the robot.

I'd like to build a dataset of input and output values to teach sklearn the wished behaviour, after that the input values should give the correct output values for the actors.

One example: if the motors are on and the robot should move forward but the distance meter tells constant values, the robot seems to be blocked. Now it should decide to draw back and turn and move to another direction.

First of all, do you think that this is possible with sklearn and second how should i start?

My (simple) robot control code is here: http://github.com/bgewehr/RPiMower

Please help me with the first steps!

Bernd Gewehr
  • 97
  • 1
  • 12

2 Answers2

6

I would suggest to use Reinforcement Learning. Here you have a tutorial of Q-Learning that fits well into your problem.

If you want code in python, right now I think there is no implementation of Q-learning in scikit-learn. However, I can give you some examples of code in python that you could use: 1, 2 and 3.

Also please have in mind that reinforcement learning is set to maximize the sum of all future rewards. You have to focus on the general view.

Good luck :-)

hoaphumanoid
  • 977
  • 1
  • 9
  • 25
  • Thank you! The task of solving a maze is clear matching to the Q-learning approach. But how do I teach a robot the correlation between "my wheels are turning" and "I do not move" to understand he's blocked by some "invisible" obstacle? That's not really a Q-Learning problem, right? Kind of a self awareness issue, isn't it? – Bernd Gewehr Jan 02 '16 at 15:23
  • You have to set everything in terms of the reward. If the robot tries to go in the direction of an obstacle you give a bad reward. If the robot is going to the place you want it to be then you give a good reward – hoaphumanoid Jan 02 '16 at 15:33
  • I'll give it a try, have to go deeper in that way of thinking! – Bernd Gewehr Jan 02 '16 at 15:39
1

The sklearn package contains a lot of useful tools for machine learning so I dont think thats a problem. If it is, then there are definitely other useful python packages. I think collecting data for the supervised learning phase will be the challenging part, and wonder if it would be smart to make a track with tape within a grid system. That would make it be easier to translate the track to labels (x,y positions in the grid). Each cell in the grid should be small if you want to make complex tracks later on I think. It may be very smart to check how they did in the self-driving google car.

stian
  • 1,947
  • 5
  • 25
  • 47