Let's Make Robots!

Learning Spin: Objects

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Chris the Carpenter's picture

This is becoming a theme --These moments of clarity where I realize something that seems so obvious in hindsight. Modify the object! I have no idea why I didn't think to do this or that I couldn't do it but I have now and it is great. Yeah, I simply added to the PWM object some extra methods that allow me to go straight to a speed without ramping. I was also able to take the ping object, strip it down and modify it to work with a LV-EZ1 sonar sensor. Problem solved. --and a lot of problems in the future solved.

Chris the Carpenter's picture

Why do your tutorials keep coming out 1 day after I figure someting out?!

http://letsmakerobots.com/node/23204

nmcclana's picture

Good video.  There are a bunch of H-Bridge motor driver objects - I don't think all of them ramp. 

One thing for all beginners to remember - a new object does not always equal a new cog.  The servo object is a good example - it will use one cog to drive the servos, but it can also use 2 cogs if you want to enable ramping.  Other objects, however, may not use a new cog (like reading a ping sensor), their methods run within the calling cog.  You could make them run in a new cog by using the cognew command, though.

TheGrue's picture

I have one method in my top object that is launched into its own Cog. It just loops over and over again. It reads variables from the first Cog to find out what PING)))'s to read and what servo position to send to my sensor array and then it launches the PING.Spin object to read each PING))) into a set of distance variables. The distance variables that it writes to are used by the main Cog in an object avoidance Method.

TheGrue's picture

I also use Servo32v7 from the OBEX to control TOBI's HB-25's and the servos. It is such a cool object!