Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Camera to motor setup (http://www.chiefdelphi.com/forums/showthread.php?t=42159)

Windward 21-01-2006 14:01

Re: Camera to motor setup
 
Acutally, I was thinking of mounting the camera on top of the turret, and setting up the motors so that it would automatically swing the turret until the camera reads 0 pan and 0 tilt without any code modification. Would that work?

Alan Anderson 21-01-2006 17:30

Re: Camera to motor setup
 
Quote:

Originally Posted by Windward
Acutally, I was thinking of mounting the camera on top of the turret, and setting up the motors so that it would automatically swing the turret until the camera reads 0 pan and 0 tilt without any code modification. Would that work?

It should, but you need to recognize something that might make it work less well than you expect. The camera code doesn't move the tilt or pan servos until the vision target gets "far enough" from the center of the view.

Windward 23-01-2006 20:29

Re: Camera to motor setup
 
Quote:

Originally Posted by Alan Anderson
It should, but you need to recognize something that might make it work less well than you expect. The camera code doesn't move the tilt or pan servos until the vision target gets "far enough" from the center of the view.

What do you mean by this?

Alan Anderson 23-01-2006 22:23

Re: Camera to motor setup
 
Look at tracking.c in the camera code provided by Kevin Watson. In the servo_track() function, it checks to see how many pixels off-center the target is. Only if it's more than Pan_Allowable_Error left or right, or Tilt_Allowable_Error up or down, does it actually move the servo to recenter the target in the camera's field of view.

So if you want to be as accurate as possible, you need to move the turret to zero the pan/tilt servo values and also cause the mx/my values returned from the camera to match the target pixel values.

Windward 25-01-2006 17:47

Re: Camera to motor setup
 
Quote:

Originally Posted by Astronouth7303
Closed loop



An encoder is a digital sensor that detects regular "ticks" on a wheel. The purpose of it is to detect either velocity or position. You count ticks and compare them to the time. In this case, an encoder can either be a tooth counter, the banner sensors, or the grayhill encoders.

sorry. I meant gyro.

devicenull 25-01-2006 18:32

Re: Camera to motor setup
 
Quote:

Originally Posted by Windward
Acutally, I was thinking of mounting the camera on top of the turret, and setting up the motors so that it would automatically swing the turret until the camera reads 0 pan and 0 tilt without any code modification. Would that work?

If you mean 127 pan and 127 tilt, then yes, it works very, very nicely ;)

Bharat Nain 17-02-2006 23:24

Re: Camera to motor setup
 
Did you or anyone ever get the Camera to Motor setup working?

Salik Syed 18-02-2006 00:05

Re: Camera to motor setup
 
Our team used a heavily modified version of Kevin's PID code,
basically all you have to do is add another motor to the motor_info data struct, and change the get_encoder_value function so that it returns PAN_SERVO when the argument is 2
now simply call set_pos(2,127)
and set your left and right drive motors to =motor_info[2].pwm+127; and 127-motor_info[3].pwm; (this may need to be change depending on your wiring and robot setup)

you may have to tweak the P, I, D constants

We had it working beautifully until we did some other stuff and screwed it up... :(
(we used our own custom PID software... but i think i'm gonna switch back to kevins because i can't figure out whats wrong with ours... and I didn't write it so I don't understand it 100%)

Windward 18-02-2006 13:18

Re: Camera to motor setup
 
Quote:

Originally Posted by Salik Syed
Our team used a heavily modified version of Kevin's PID code,
basically all you have to do is add another motor to the motor_info data struct, and change the get_encoder_value function so that it returns PAN_SERVO when the argument is 2
now simply call set_pos(2,127)
and set your left and right drive motors to =motor_info[2].pwm+127; and 127-motor_info[3].pwm; (this may need to be change depending on your wiring and robot setup)

you may have to tweak the P, I, D constants

We had it working beautifully until we did some other stuff and screwed it up... :(
(we used our own custom PID software... but i think i'm gonna switch back to kevins because i can't figure out whats wrong with ours... and I didn't write it so I don't understand it 100%)


We don't have encoders working and it is far too late to implement them into our bot.


On a side note, we did the zero point method making the servo's and motor values equal to the search value, it works beautifully when we implemented. Basically the human player controls the turret until the "find target" button is pressed. Then the camera re-aligns the turret to aim for the green.

Salik Syed 18-02-2006 20:29

Re: Camera to motor setup
 
Quote:

Originally Posted by Windward
We don't have encoders working and it is far too late to implement them into our bot.


On a side note, we did the zero point method making the servo's and motor values equal to the search value, it works beautifully when we implemented. Basically the human player controls the turret until the "find target" button is pressed. Then the camera re-aligns the turret to aim for the green.


you don't need encoders, you can fake the system.... just put the camera pan servo value in place of the encoder count, the PID math is the same


All times are GMT -5. The time now is 20:28.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi