DiddyBorg - Record movements

Hi,

I am new to roboting and python programming and have some general questions:

Is it possible to record the Diddyborgs movements and play it back, so to make it 'learn' a path to go.
Do you have an example script for this?

Is it possible to implement IR sensors and make it avoid barriers autonomously?
An example script would be helpful here as well.

Many thanks in advance.

piborg's picture

It should be possible to record some manual movements and then play them back.

There are two simple ways of recording the movements:

  1. Save all the motor power levels and the time they are set to file
    This would require adding some code to the standard script
  2. Make a script which reads the motor power regularly and saves the values to a file
    This is simpler as it does not need the times, but it requires running both scripts and may be slightly less accurate

In both cases you will need a second script which reads the file back in and repeats the same outputs.
For option 1 you would run the commands with the same delays, option 2 will have the same delays as the recording script.

We have an example of the second method for LedBorg here: Replay - Record your LedBorg, then play it back later.
Instead of the GetLedColour function you will want the values returned from PBR.GetMotor1() and PBR.GetMotor2().
Instead of the SetLedColour function you will want to set the motor speeds using PBR.SetMotor1 and PBR.SetMotor2.

Infra-red is probably not the best way to detect barriers as some things reflect IR and others do not.
What would probably make more sense is to use ultrasonic modules to see how far away the nearest obstacle is.

There is a post on the forum which talks about collision avoidance using ultrasonics with our Web UI: Diddyborg with Ultraborg over Web UI.
The post is a rather long read, but it may prove helpful in explaining some basic avoidance code.

Thank you for your interesting answer. Now I only need to enhance the WebUI with Record/Play buttons ;-)
Regarding barrier detection it would be best if it could be done with the camera alone (ultrasonic might disturb pets). But this may be beyond raspberry's image processing capabilities.

Subscribe to Comments for "DiddyBorg - Record movements"