DiddyBorg - Record movements
Forums:
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
Thu, 04/28/2016 - 12:50
Permalink
DiddyBorg Recording movments
It should be possible to record some manual movements and then play them back.
There are two simple ways of recording the movements:
This would require adding some code to the standard script
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 fromPBR.GetMotor1()
andPBR.GetMotor2()
.Instead of the
SetLedColour
function you will want to set the motor speeds usingPBR.SetMotor1
andPBR.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.
hli
Thu, 04/28/2016 - 15:23
Permalink
Thank you for your
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.