Motion - Support Question 2006x 01x 03x 071110

track_center() and other questions about tracking code

Question

Hello,

I would like to adapt Motion's motion tracking features for a stepper-motor project I'm working on. I would appreciate clarification on some of the code

1. It would be helpful if I could a get brief overview of how the motion tracking system works

2. What exactly is track_center() supposed to do? Most importantly, under what situations/when is it supposed to be called? I'm guessing it setups the serial port for track_move(), and takes the camera to some sort of "home" position. It seems to me that track_center() should be called at least once before track_move(), but then it seems possible that motion_detected() (which uses track_move()) could possibly be called earlier in the motion_loop

3. In the function static int stepper_center(struct context *cnt, int xoff, int yoff) in track.c:
   stepper_command(cnt, cnt->track.motorx, STEPPER_COMMAND_SPEED, cnt->track.speed);
   stepper_command(cnt, cnt->track.motorx, STEPPER_COMMAND_LEFT_N, cnt->track.maxx);
   while ((stepper_status(cnt, cnt->track.motorx) & STEPPER_STATUS_LEFT));
   stepper_command(cnt, cnt->track.motorx, STEPPER_COMMAND_RIGHT_N,
       cnt->track.maxx/2+xoff*cnt->track.stepsize);
   while (stepper_status(cnt, cnt->track.motorx) & STEPPER_STATUS_RIGHT);

Where is the stepper suppose to be at the end of all this??? In partcular, I curious why the stepper is asked to turn left a number of steps equal in number to the maximum stepper position? This makes sense to me only if the stepper is assumed to start at position 0, but is this necessarily the case?

4. The above code snippet in (3) uses busy-while loops to keep the system paused while the stepper is turning. Why are they employed here, but not in stepper_move()?

5. In stepper_move(), why is n divided by 5 returned following a command to the motor?

I know that's quite a few questions, but I hope you'll be able to at least answer 2 and 3. Thank you very much.

Ivan Chan

Environment

Motion version: 3.2.3
ffmpeg version: 0.4.8
Libraries: ffmpeg, mysql, postgresql
Server OS: Mandriva Linux, kernel 2.6.11

-- TWikiGuest - 03 Jan 2006

Answer

Ivan the code of stepper is being improved , i added it recently support for Tilt so now if you build a stepper with 2 motors you'll be able to use Pan/Tilt.

1/2 Yes stepper_center is to move the stepper to the "home" center but for sure it can be improved.

Point 3/4 That function is to point the stepper to center has not sense to do it that in move() where you can move i.ex one stepsize left position or 3 stepsize right positions.

Point 5 has been remove because it did nothing a replace by cnt->track.move_wait , that is the amount of time that motion should wait before to start a new movement.

Please try to look to StepperMotorPanTiltHardware where will be explained how to build a Pan/Tilt Stepper.

-- AngelCarpintero - 02 Mar 2006

SupportForm edit

TopicTitle track_center() and other questions about tracking code
SupportStatus AnsweredQuestions
AssignedQuestionTo
SubmittedBy Ivan Chan
Topic revision: r2 - 02 Mar 2006, AngelCarpintero
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.