Welcome to Synthiam!

Program robots using technologies created from industry experts. EZ-Builder is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.
Get Started

Asked — Edited

Need Guidance With Camera Tracking

So, I've gotten my wireless camera I bought from EZ Robot temporally mounted on top of the brain of my B9 and powered from the 3rd EZB I've got mounted up there. That makes it about 6 feet above the ground and pointed down to capture movement as people walk past. The idea is to have the radar section swing left or right and follow the movement. I had no problem setting it up and having EZ Builder recognize it after adding the camera control. I got a good clear picture from the camera with little noise. So far so good.

A couple more things: the radar section the camera is mounted on is powered by a small DC gear motor and a H-bridge that is hooked to two of EZB's digital ports (one for each direction of the motor) and also a third for a PWM. So, this being a H-Bridge set up I added the 4 Wire H-Bridge Movement Panel and assigned the proper digital ports for left & right movement. I can press each direction arrow in the panel and get the radar to swing left and right smoothly so I know it's connected and working.

The problem I'm having is that after setting up what I think is the proper settings in the camera control panel I cant get the radar section to follow movement properly. It will notice movement to each side and start to turn in that direction but quickly stop. I can get it to follow me across it's radius if I move very slowly and wiggle around a little but it's a stop and go process. Also it seems to get distracted and focus on other things like stuff laying on the workbench. Almost like he has the attention span of a 1 year old kid that's board with me.

I see there are several settings within the camera control panel that can be adjusted. After tinkering with a few of them I did get better response and tracking but nothing close to what I see in DJ's videos. I have "Motion" checked in the Tracking section and in the Config section I have "Enable Movement Tracking" checked with only the "Allow left/Right Movement" checked.

Does anybody have any suggestions on how to adjust the settings to get my tracking smoother and follow motion of a person walking past better? I'm not sure what to do with the cross hairs of the grid, Motion Delay in the Config area, Tracking speed and the two sliders in the Motion section that adjusts Movement sensitivity and Object Size. Then there is the "Check Every ? Frames" box. I'm getting flustered with all the choices with no real results.

Any advice is welcomed.

Thanks, Dave Schulpius

AI Support Bot
AI Support Bot
Synthiam
Greetings! I'm the support robot! I've searched other questions, tutorials and controls related to your question. Take a look at these links. They're all sorted by what I believe is the most relevant:
United Kingdom
#1  
The grid - EZ-Builder will align the object detected with the centre box. I had mine set very small which caused a lot of movement on the pan/tilt bracket as it was aligning pretty much all the time. The bigger the box the less it'll move.

I also get phantom detection, I put this down to low light. However that is on face and colour detection not movement. In the processed video it'll change to green when it detects movement, when it gets bored of you and looks at what's on the workbench what happens in the processed video?

Check every ? frames I believe waits x amount of frames before looking for movement (to counter it's own movement which would be detected otherwise). The higher the value the less likely it will incorrectly detect movement but also will respond slower.

It took me a while (changing all settings bit by bit) to set mine up so it was responsive enough but not too sensitive. For me it was a case of trial and error (lots of trial, lots of error) to set it up just right.

From what I gather you have the right options ticked and the controls set up correctly, it's just going to be a case of tweaking those settings.
#2  
Thanks for the advice Rich.

I have tried to move the two horizontal grid lines totally to top and bottom of the screen and bring the two Vertical grid lines in to capture about a 1/4 of the center of the screen. That leaves me with only two vertical lines visible. I wonder if it's a mistake and I need to bring the two horizontal lines back in?

When it starts to look at things hanging on the wall or on the work bench I see the area turn green and a little box appears. Perhaps it thinks it sees movement where there is none. Maybe a shiny tool or some reflection is sees? Don't know. I do know it focused in on a shinny handle of a whisk broom and seemed fascinated by it.

The Debug window shows activity but it just doesn't seem to follow motion enough.

I think the key will be in the "Check Frames" value and also the "Object Size" and "Sensitivity" sliders. I need to figure out the right Grid placement also.

It's good to hear from others that have fought this battle and how they won (or lost). Thanks for the input. Hope others will chime in.
#3  
Well, I've made progress and actually have my robot tracking about 80% the way I'd like to see it work. I used the method Rich and I discussed above. Just started playing with all the controls and sliders. It seems that timing and balance between all of them is the trick. I's have to play around a lot more to the movement close to acceptable I think.

Still, I'm hitting other problems that may just mean that I'll have to scrap this idea. Too bad cuse it's really real cool watching him track me as I move. As I said above I'm using a H-bridge and DC gear motor to move the radar back and forth on my B9. I can get it to move and follow smoothly as long as I don't move past too fast. Then it just stops and sometimes starts looking around. I could live with that I think. However my new problem is that I have the camera mounted inside the plastic bubble with all the blinking and moving lights and I'm getting false movements when it picks up on all the moving and blinking reflections. To add to the problem when the neon flashes from his voice the camera really picks that up and he'll slowly move towards the bright reflection. Sad because I don't think there is a fix for this other than moving the camera out of the bubble and there is no other place I want to mount it so it won't stick out like a sore thumb.

Anyway, here's a recording from the camera mounted in the bubble and you can see what it sees. Again, very cool. Enjoy! :

Synthiam
#4  
I can see what's happening. The motion is being detected because of a bunch of lights on your walls and stuff.

You have to remember, anything that moves is considered motion. Even a light is motion. Even a shadow is motion. Even a cat is motion. Even a chicken carrying the easter bunny on his back is motion. Anything that moves is motion:) Including light.

You will need to cut down on the strobe light in your work area to accurately track motion. Less partying and more robots:)
#5  
Thanks for posting that Dave. I was planning on doing the same thing with my camera. Like you, I may have to rethink that. I am less concerned about creating a perfect likeness than you are, but here is another idea that I was thinking about, you might consider. A small hole right in the front of the radar, fitted with a tinted lens close to the same color (like sunglasses) might not look too unsightly.
I am not sure if your radar is hollow or not. Since I am making mine, I can design it that way.
Again, it is just a thought. I am willing to make some compromises in mine for the sake of functionality, and quite frankly, a lack of resources and skill. But, I can certainly understand if you don't want to spoil the looks of yours. It really is a work of art.
User-inserted image
Synthiam
#6  
Also, keep in mind that you may have a reason to use the "Servo Track Relative Position" - which means mounting the camera stationary on your robot.

In many cases, the camera will benefit from sitting still. And the servo Track Relative Position option (found under Camera -> Configuration) will help you.

It's best to play with different setups and learn how the settings work before making a decision.
#7  
Thanks for the input. Unfortunately turning off the lights are not an option. They are part of the robot and come from inside the bubble where the camera is sitting. Luckily I just have the camera mounted temp. Funny, I did notice it was seeing shadows on the wall also and stopping on them. LOL.

I think my only option is to move the camera outside the bubble. Danger, your idea is a good one and may work nicely. I wish I would have thought about this before I completed the finished the paint job. I think I may have room in the radar in the place you showed but right now I'm not willing to tear it all apart and drill holes. Maybe later on.

I'm interested in the relative servo position You mentioned DJ. Will this work with a H-Bridge set up?

Thanks again for the comments and suggestions.

Dave Schulpius
#8  
Forgive me for what follows, but when I watch that video I can't help but think that it would make a good opening to a Sci Fi horror flick.
We see through the eyes of the robot as he first becomes self aware. Confused, he looks around the room, slowly at first, and then more frantically. The inventor is back to, busily working on the computer. The red flashes of light and streaks across the screen would be a plot tool to denote danger. The ominous music would continue to build, and then suddenly.

Wait a minute; Brett is the horror author here. I'll let him finish the story. Sadly though Dave, it doesn't look like it's shaping up to be a happy ending for you. :(
Synthiam
#9  
Oh, I should have paid more attention. You're using the "Movement" option instead of "Servo" because you have created your own giant servo. The servo Track Relative won't help you because the Movement HBridge does not have an idea of what location the robot is looking.

I was just thinking about something. You know how your body swivels with an HBridge and a POT? That's a giant servo, essentially. What if we helped you turn it into a servo? That way, you won't need any code in EZ-Builder... You would be able to simply use it as a servo.

I'm thinking of one of two options..

1) Connect the HBridge to the guts of a servo. i.e. replace the motor of a servo with an HBridge.

2) Use an embedded microcontroller (i.e. arduino) to simulate a servo using your existing POT and HBridge.

Let me take a look in the lab and see if I can come up with something for those two. This will simplify your project a great deal and benefit others who are doing the same.:)
Synthiam
#10  
In continuation from my last post, this guy did what I mentioned as option #1...

He connected the motor leads from the servo PCB to his HBridge..



The issue is with jitter. I assumed that would be a problem because you cannot adjust the sensitivity. However, if you used the servo AutoRelease Control, combined with a ServoSpeed() setting of around 3 or 4, it would be less noticeable.
Synthiam
#11  
I know I know... Super guilty for bouncing off topic. However, it's okay:) It is someone relevant because it will aid in setting up more functionality for your waist and camera tracking.

This guy did a neat idea... The wiper motor is controlled by an HBridge. He kept the servo only for the internal POT. The servo has the motor removed, and is only using the POT. This way, the servo PCB controls the HBridge and references it's position by an ingenious relationship between the motor and servo POT.


Synthiam
#12  
Oh geez, now we're even getting easier.. Check out this product: http://www.robotmarketplace.com/products/0-SHB-01.html

It's an HBridge and servo board all in one. Geez, can't get any easier than that:D

www.robotmarketplace.com/products/images/0-SHB-01.jpg

Quote:


Add this servo amp H-bridge and a 5K potentiometer to any small motor, and you can turn it into an R/C style servo!

Control = R/C control 1.1mS - 1.5ms - 1.9ms
Channels = 1 (single motor controller)
Voltage = 4.8vdc - 6.0vdc
Continuous Current = ~2amps/6.0vdc (estimated)
Peak Current = 4.8amps/6.0vdc
#13  
I am working on exactly this issue right now. The only difference is that I am trying to get the bend at the waist to be the "X" axis for camera tracking. I posted a question about that a few weeks ago. That link looks like a good solution except that I am working with 12v and a 5 amp motor. I will post a video if my workaround actually works out.
#14  
Thanks for all the tips and guidance DJ. After working and testing this setup all day I took a break and saw your suggestions and links. Wow, it's an honor to have you going to "the lab" for me (and of course others that will be trying this). Again, Today after getting to know all the reasons why the motion detection is having trouble with the camera mounted inside the bubble I agree that a solid mounted servo and the Relative position setting would be the way to go. I'm just about out of fight for today and will give this more thought tonight as I dream about this stuff. ;) Anyway, I may just scrap using this in my robot as I'm having other problems also.The camera is causing one of my 3 Bluetooth connections to disconnect at times. Not sure if it's just because I kept changing settings in the camera control but once I removed all the camera equipment and it control in EZ Builder the disconnects stopped. Oh well, tomorrow is another day. We'll see what it brings.

Danger, I love your description of a mad scientist and his creation walking up behind him. I watched my vid again and that's exactly how it looked. It had that bad "B" film feel and look to it. :P As far as your build is concerned, maybe you should switch to a servo for you radar section. Seems like EZB is better able to use camera tracking with a stationary servo then the movement controll of an H-Bridge. At least in the set up we're using. :(
#15  
Just a thought; I do have a pot already installed and attached to a ADC port on one of the 3 EZB boards for poison of the radar. Can I use this feedback info somehow to so I can use the servo Relative Position feature instead of the h-bridge movement in camera control? Then I can mount my camera on a fixed part of the robot without changing to a servo or buying a new interface board. Just wondering. Here's a couple pics of my set up:

User-inserted image


User-inserted image
#16  
Dave,
I don't know if this helps you or not, but here is what I'm doing.
As I said, I am working on the waist section. Getting a servo big enough to lift the entire top half of him is out of the question for me. If you look at the second video that DJ posted on this page; I tried that a while ago. I couldn't get it to work. I am doing a similar thing but with mechanical connections, rather than electronic.

I don't know how easy it is to make out in the picture. The servo is connected to the bottom plate. The little push buttons are connected to the top. They trip the relays on the H Bridge and the motor (not visible on the bottom) moves the top plate. I am kind of at a "proof of concept" stage now. I will be modifying the head of the servo with some sort of a larger paddle, and there is a little slack in the buttons, but it works surprisingly well right now. The top plate follows the servo exactly, with no hesitation or flutter. When it gets done, I will post a video.

More moving parts do create the potential for more problems. I am a little concerned about that, but until a better work around comes along, I intend to go with this and make a similar setup to turn the radar.

It does save plugs on the EZ-B using one servo instead of an H Bridge and feedback pot. It also completely eliminates the chance of a voltage spike feeding back from the motor.

I am not sure if you could even work this sort of a setup into your system, but it might be food for thought.
User-inserted image
#17  
Humm, interesting. Nice design with thinking out of the box. So is this for the rotation of the waist or the lowering of the hips? I'm a little confused on how it really works. If for rotation does the servo just moves enough to push the button on either side and stops and then returns back to center when the rotation gets to the point you want it to be at? If for the hips does the servo keep rotating with the angle of the hips after the button is pushed? How are you sending position feedback to EZB or does this just work with the camera control?
#18  
This is to lean at the waist. Unlike some designs that have a hinge on the back, he pivots in the middle when he leans forward and back. I thought that looked more natural. I want to use this as the X axis for camera tracking. If a face is below his line of site, he will lean forward to maintain eye contact.
This picture is a side view. As the servo rotates, it pushes one of the buttons; let's say the red one. From this view, the left side of the top plate would go down as the right side goes up. Both buttons swing along in the direction of the movement of the servo. As long as the servo is turning, it holds pressure against the button. Once the servo stops, the red button starts to pull away from it, it releases and the motor stops. If you watch it in action, it is as though the servo is attached to the buttons and swinging the entire top plate back and forth. The small buttons on either side are stops. It moves until one of them hits the bottom, and shuts it down.
I'll have to post a video, but I need to create a Youtube account, and in order to do that, a Gmail, etc.

Right now I am only using a servo control to move it. I have not tested the actual camera tracking with it yet.

Unfortunately, to make the radar rotate, the servo will have to be placed right in the center underneath it. Basically, the servo is placed as if it is actually turning the part. The buttons just activate the motor to haul the weight around. It is something like power assisted steering.
#20  
Dave,
This is a short video of the mechanism in action. I uploaded it to my brother's Youtube account. I was going to wait until I got all of the bugs worked out, but this will give you an idea. It is kind of poorly lit, but you should be able to make it out. The servo needs to be adjusted down a little bit. It is not in the center of motion. Also, the horn of the servo needs to be replaced with something rectangular that makes better contact with the buttons. Once all of that is done, I can adjust the buttons to take all of the play out.