Let's Make Robots!

Transition Ideas

I'm making a sort of alternate version of yellow drum machine. It uses the sharp proximity sensor. I was wondering how I would make the robot transition from navigating to playing the drums on the next object it encounters. I was thinking a switch, but that seems to weird. I want it to switch by itself. 

I wander how fritsl got his drum machine to transition.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

One would write a series of instructions. These instructions would allow the robot to switch between tasks based on changing variables. A simple example could be:

if variable = predetermined_threashold then do something

Frits has posted on the logic behind his YDM. It looks for stuff to drum on. When it detects an object in range, it "snakes" its way up to it so that it is square (90 degrees, orthagonal, pick your geometrical adjective) to the object. Then it pulls up close enough and starts to play.

He's got a post on here somewhere about "teaching" your robot, rather than programming it, and he uses the YDM as an example. If programming the "frits" way appeals to you, you should definitely search for that post.

Yeah. I wanted to know how it switched from navigation mode to snake mode. Still a mystery to me.

During a range test within the 'Navigator' routine, range is tested.

if range > 155 then gosub Driveforward...


if dist > 55 then ....

goto SnakeStart


Does that help?

  1. Does the range test appear after a certain amount of time, or is it at the end of the Navigation routine.

It is all going on at the same time. As the unit navigates, it is also looking for objects. With that, it is not even really looking for objects as much as it is looking for 2 edges and figuring the width between.

I gotta be honest with you, tofu... Based on the nature of your questions, I think this might be something you might want to work up to. This is not really a cut-and-paste kinda operation and it sorta falls into the "you are on step 7 and asking about step 482" catagory...

Sorry. I just got the navigation of the robot down. So I wanted to work on how it was going to transition form it to drumming.

It stops driving and starts drumming when it finds it's object.

Edge find left

Edge find right

Calc width

if width >=  threashold then center yourself

recheck distance

close distance

if distance = close_enough_to_drum + or - threashold then drum

drum sequence starts

drum sequence ends

return to main

Thanks! I needed that.

You do know that Frits posted all his code, right? You can read the whole thing. Have you finished your edge find routine?