Shop OBEX P1 Docs P2 Docs Learn Events
(relatively) Simple Halloween Project — Parallax Forums

(relatively) Simple Halloween Project

Hello everybody,

My name is Steve and I'm pretty new to robotics. I got an ActivityBot for my birthday and I've been playing around with it a good deal. Now Halloween is coming up and I would like to turn my ActivityBot into a display at a haunted house that my college chapter of the Florida Engineering Society is hosting. My idea is to mount a decorative "head" on top of the main chassis of the ActivityBot, and have a rotating PING))) sensor detect objects in a range around the chassis, then, compare distances of objects around the ActivityBot and simply "point" the front of the head towards the nearest of the objects.

The purpose is for the "head" to simply rotate in order to be "looking at" the nearest person walking in front of the ActivityBot until that person moves out of range, then to find the new "nearest object" and rotate to be "looking at" that object. I was thinking that the easiest way to acheive this would be to have the chassis stay completely still, and just mount the "head" on a rotating platform that could then be turned by the servo's of the ActivityBot.

I've been programming in C using SimpleIDE as the tutorials for the activity bot recommend, and I would just like some help developing the code I can use for my project as I have little programming experience outside of the ActivityBot tutorial.

If this should be posted somewhere else in the forum's please let me know.

Thanks
~Steve

Comments

  • ercoerco Posts: 20,254
    edited 2015-08-26 04:15
    Welcome to the forums, Steve! I made a similar routine that appears to track you. Just make the head servo oscillate constantly while checking your PING distance sensor. When you get a reading closer than X feet (your choice), stop the head. Once the person moves, resume scanning from the last position. You have a 50% chance of scanning in the right direction (left-right or right-left). If you get it wrong, it will catch the person on the next oscillation. Works pretty well for how simple it is.

    Also, I'll remind people before Halloween that a simple TV IR remote control works great outdoors at night. Second video shows my IR-triggered routine.



  • Hello Erco! Thanks for the quick response!

    The idea I had was to assign a variable to each of 5 or 6 different positions along the arch that the ping sensor travels, then have it check those values against each other to find which is the smallest, and then move the that position. That way, it will always choose the closest person and not just the first person within a given range. Each time the ping traveled its arch, it would rewrite(refresh?) those variables so that it is continuously searching for the nearest person. Of course, having the idea and know how to actually code it is two very different things.

    So, the way I see it, the differences between your setup and mine are then, where you want the sensor to stop when it see something, I want mine to continue to move constantly but tell the computer which of the directions has the smallest distance assigned to it, then move a decorative piece on top of the robot towards that direction.

    I guess what I am asking for is examples of code that might achieve something similar to what I want, that I can then change and use for my own project as I have very little experience writing my own code.
  • ercoerco Posts: 20,254
    edited 2015-08-27 02:44
    You may find that you'll want two servos to achieve your goal. Servo #1 swings the PING to map the area, directing servo #2 to aim the head at the closest person, while servo #1 and PING continue to sweep the area.

    Have you seen the PING-dar demo?

  • The ActivityBot that I have came with two servo's, both to run the two main wheels, as I don't want the chassis to move at all, I was just going to use them to aim the head, while I used the front mounted servo that I received in the mail today to swing the ping sensor.

    I've watched that video, and it looks like it would be a great deal of help, except that all of it is done in reference to the Boe-Bot, and done in a completely different programming environment than what I was using for the ActivityBot tutorials. As I said in the first post, I have really only used SimpleIDE which codes in C I believe(could be C++), but all the source code for that Ping)))dar video are done in an environment that my computer does not recognize. So I have no way of using it for my project. To be honest, im not even sure how to move the 3rd servo that ive just attached to my robot, though im pretty sure I've attached it correctly.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-08-28 08:10
    steve991 wrote: »
    The ActivityBot that I have came with two servo's, both to run the two main wheels,

    Those are continuous rotation servos. It could be argued (and IMO successfully) those aren't really servos. They can be commanded to move a certain speed but you can't tell them which position to move. If you used the encoders which came with the AB, it could be possible to monitor the position of the "servo" but it's not really a trivial task (which moving a servo is).

    Have you looked through the Learn tutorials for normal servo examples? I'd be very surprised if there aren't examples of using SimpleIDE to program servo movement.

    I don't use C with the Propeller much myself so I'm not sure where to look.

    I could find you lots of information about controlling servos with Spin.

  • Okay, but even if they arent really servo's I believe I know the logic required to make the project work with the continuous rotation servos, my difficulty lies in being able to call the front mounted servo in my code, which I have no idea how to do. Also, I then need to tell the Ping to take a distance measurement at certain angles/degrees/distances, which I think I can do once I know how to move the front mounted servo.

    Ive done all of the tutorals found here at the bottom of the page. I also looked through the Learn Forum but I did not see anything that I thought would be usefull. If I missed something or I should look somewhere else please let me know.
  • Take a look at this page:

    learn.parallax.com/propeller-c-simple-devices/standard-servo

    I think it's a good starting point.
Sign In or Register to comment.