How to rotate camera to target; motor to the angle of the camera

Hi i had a few quesitons that i needed help with. One of the mentor has thrown a challenge for me to make the robot do this in autonomous:

    Rotate the camera(We are using Axis camera provided in 2010 season) to 
    find circular target.

    Rotate the drive motors to the angle of the camera(since camera is         facing the target).

    Dirve to target.

My questions are:
(1) Do i use the Rotate to target.vi provided?
(2) how do i retrieve the angle and tell motor to go to that angle

Need a little guidance in getting started in the basics of this problem. The rest i shall do myself :slight_smile: Thanks

My suggestion would be to start with the sample code that came with the 2010 kit. Visit the different team code routines and review what the code does versus what you think you need it to do.

Finally, dig into the Autonomous Independent. It is built upon the Rotate to Target VI, which does a portion of your task, but not the whole thing.

If you have access to the robot, execute the code, make modifications, learn how to debug it to better understand what the sensors return, what values are sent to the motors, etc.

Finally, feel free to ask more questions if you need to.

Greg McKaskle

What aspects are built in? Because the only thing i see for when i open autonomus independent.vi is only moving the bot. Picture is below of what i get when i open the built in autonomus independent.

autonomus.doc (89 KB)


autonomus.doc (89 KB)

It looks like you haven’t run your mandatory LabVIEW update, found here:
usfirst.org/frccontrolsystem

Run that update, and then create a new project.

I updated it and got a chance to look at the code. I have a few questions :
(1) what is a gyro? I have heard about gyro several times, but i need to know what it is to know what the code is doing :slight_smile:
(2) Does this rotate the camera? :s because no where in the code do i see the camera (192.168.0.90) get called.

or is the gyro connected to the camera which moves it? If someone can clarify this for me it would be cool :slight_smile:

Whcirobotics

A gyro tells you rate of rotation; it tells you how fast you are turning.
It is connected to an accumulator in cRIO, which continuously adds the value received from the Gyro, thus calculating the direction from the rate of rotation * time.

The gyro is on the robot. The camera is on the robot. Thus, the camera turns when the robot turns.

Is there a way to move the camera first … make it look for the target. as soon as it finds it, turn the robot to the direction which the camera is lookiing,(which would be target)?

whcirobotics

Do you have the camera gimbal? One was in the kit in 09. It has one or more servo motors hinged together and mounted between the robot and camera. It allows the camera to swivel about mostly independent of the robot – like a neck.

Greg McKaskle

I don’t know about in autonomous, but one of my first programming challenges I was given last year was to program the 2009 gimbal to take input from a joystick. Figuring out a way to have the camera move on the servo, and then have the robot read the servo position and rotate to that angle would be complex, but if I get time, (and my LabView stops crashing) I will look into some sample code.

For using a joystick in Teleop, just throw in a Joystick Get, use an unbundle by name, and attach it to the axes output. Run each axis to a mathematical equation box, which contains the formula (for the 2009 KoP joysticks) ((X+1)*85), then run the output to a servo set VI. IF that did not make sense, check out the picture included (Note: the example used is from a complex test code I wrote for a “super” bot, so there are lines of code all over, if you can understand it great, if not, PM me and I’ll try and find a clearer pic)





Hi sithmonkey13,

I am stuck at understanding the concept regarding tracking the target with the provided Axis Camera. my question is:

What is a gryo?

Is something attached to the axis camera so it can move to look for target(up, down, left, right) or does it have the capabilities already?

And if it does internally have the capabilities, how do i talk to it. What is it called in the labview program?

I am getting confused at how to move the camera, do i attach two servos, one that moves camera left and right, and the other up and down? and get the angle of both and set that as the angle in which the motor move?

Help would be greatly appreciated :smiley:

Whcirobotics

“gyro” is an abbreviation for gyroscope.
However, when implemented as a sensor, it’s easier to make something that tells you how fast you’re turning, rather than spinning a disk and telling what direction you’re facing. The cRIO takes care of converting this rate of rotation into direction.

This is the gimbal that comes in the FRC kit of parts. It uses two servos; one for pan (side to side) and one for tilt (up and down).
You can control the servos with the VIs in FRC Framework > Motors and Actuators > Sevo

Yes.

You may already be on the right track, but let me give a few clarifications.

The camera is a sensor, and all by itself, the camera cannot move the robot, it cannot move itself, and it cannot move the servo. It simply returns images.

A motor will only rotate its shaft in a given direction at a given speed. A servo motor is similar, except that it is aware of where it has turned its shaft to, and will stop and hold that position.

Each of these items has a set of VIs to control and communicate with in LV, and for C++ and Java, there are textual functions and classes for doing the same.

The example programs and default code will show how to use the software to direct the motors, servos, cameras, gyros, and the like to do bigger tasks. Feel free to ask more detailed questions as you focus on smaller parts of the overall task.

Greg McKaskle

What is the nimbal? Please specify

Is it a part that you attach on the axis camera with has the servos which enable the Axis camera to move?

Camera gimbal photo courtesy of AndyMark.
Also known as a pan-tilt assembly.

CameraGimbal.jpg


CameraGimbal.jpg

O Goodies! I have seen this! Now i know how i am going to complete this challenge! Thnx!!! I will write the code right at this minute and get back to you guys if i need some help. :slight_smile:

Whcirobotics

:o Started looking the code in detail and as expected ran into some trouble… i have a question.

Can i just remove the gyro from the autonomus independent.vi, because i am going to be using the servos (the gimbal) to get the angle?

Yes, you can remove the gyro references.

Hi everyone. I finally got time to write some code and i ran into some … problem . I do not know how to connect the “x and y” axis of the “Rotate to Target” vi to my servo angles. Because what i want the camera to do is, first set the servos to 0 angle, then after 1 mil second keep adding 10 degrees to each servos and rotate the camera to that angle and look for the image… If i am doing something wrong tell me :slight_smile:

I have attached a picture of what i wrote so far below

Whcirobotics

move to target.doc (83 KB)


move to target.doc (83 KB)