Tracking Servo motor with drive motor in Labview

I am a new mentor, also new to First Robotics and LabView. Will Appreciate support. I am using the LabView ‘Two Color Servo Camera’ Example to find and track Foe.

I am attempting to add a drive motor to find location of servo camera once it locks onto foe, position motor (top of robot) & align with camera location, then have drive motor track with camera servo as target moves.

The way I am trying to do this, is read back servo (x position) and drive motor setting. If servo number more positive, then the drive motor would have to turn right??, servo will have to turn left to keep tracked. Once camera sevo approaches zero (camera is centered to Robot top), I know they are aligned, now need to track motors while still locked on Foe.

Can I use the the (1 to -1) setings on motor or do I need to read the PWM location? For example, does +1 = PWM 255 (full foward)?

Is outputting ‘0’ to servo motor the same as sending PWM 127 (Centers Motor)?

What is the best way to correlate the servo and drive motor, ie. Servo moves +.1, how much dose drive motor have to drive?

I can read PWM location using PWM-GetValue VI, would I use PWM-SetValue VI to drive motor


First of all yes, the servos go from -1 (PWM 0) to +1 (PWM 255).

You sound like your on the right track as far as getting the turret im assuming to align with with servo position, but this will require a rotation sensor on the turret and some form of a control loop (lookup PID loops) to allow you to set a target positon for the motor to try and reach based on the servo position.

What I would do instead is attach the camera to the turret and then let the motor act as your servo and the you can just use the normalized_x values to run the motor which makes things a little simpler and more accurate if done right.

Im using C++ so as far as doing any of these things in LabView im not much help.


Thank you for your reply/suggestion…

Using motor as servo: Won’t there be too much rotation on terret during seraching mode?

Yes, if you mount the camera to your turret rigidly, you’ll get a lot of motion on the turret when you’re searching for a target, which may not be desirable (although there certainly are designs that can make this work).

It sounds from your description that you’re mounting the camera on the turret, then tracking with the camera while turning the turret until the camera servo is zero’d. As i think you’ve found out, controlling rotating pieces attached to other rotating pieces can be a bit tricky :slight_smile: Instead, try moving your camera so it’s not on the turret. Now it can still rotate 180 degrees about your robot, and you’ll know the exact angle to another robot. from there, throw a rotary encoder on your turret and use feedback from that to turn the turret angle to match.


If you are working in Labview, the FRC Programming Guide indicates that the Servo and use values from 0.0 to 1.0, and the Servo and use angle in degrees.

yes, Eagle, this is what I am trying to do and it is trickey

I will run your suggestion by my Team… My hardware guy may not like it