Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   How to rotate camera to target; motor to the angle of the camera (http://www.chiefdelphi.com/forums/showthread.php?t=87450)

whcirobotics 08-11-2010 18:22

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 :) Thanks

Greg McKaskle 08-11-2010 19:09

Re: How to rotate camera to target; motor to the angle of the camera
 
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

whcirobotics 08-11-2010 19:48

Re: How to rotate camera to target; motor to the angle of the camera
 
1 Attachment(s)
Quote:

Originally Posted by Greg McKaskle (Post 980149)
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.

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.

kamocat 08-11-2010 20:59

Re: How to rotate camera to target; motor to the angle of the camera
 
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.

whcirobotics 08-11-2010 22:40

Re: How to rotate camera to target; motor to the angle of the camera
 
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 :)
(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 :)

Whcirobotics

kamocat 08-11-2010 23:47

Re: How to rotate camera to target; motor to the angle of the camera
 
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.

whcirobotics 09-11-2010 07:45

Re: How to rotate camera to target; motor to the angle of the camera
 
Quote:

Originally Posted by kamocat (Post 980210)

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

Greg McKaskle 09-11-2010 08:14

Re: How to rotate camera to target; motor to the angle of the camera
 
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

sithmonkey13 09-11-2010 21:20

Re: How to rotate camera to target; motor to the angle of the camera
 
1 Attachment(s)
Quote:

Originally Posted by whcirobotics (Post 980218)
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)?


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)

whcirobotics 10-11-2010 17:28

Re: How to rotate camera to target; motor to the angle of the camera
 
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 :D

Whcirobotics

kamocat 10-11-2010 18:02

Re: How to rotate camera to target; motor to the angle of the camera
 
Quote:

Originally Posted by whcirobotics (Post 980411)
What is a gryo?

"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.

Quote:

Originally Posted by whcirobotics (Post 980411)
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?

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

Quote:

Originally Posted by whcirobotics (Post 980411)
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?

Yes.

Greg McKaskle 10-11-2010 20:06

Re: How to rotate camera to target; motor to the angle of the camera
 
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

whcirobotics 10-11-2010 21:36

Re: How to rotate camera to target; motor to the angle of the camera
 
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?

Mark McLeod 10-11-2010 21:54

Re: How to rotate camera to target; motor to the angle of the camera
 
1 Attachment(s)
Camera gimbal photo courtesy of AndyMark.
Also known as a pan-tilt assembly.

whcirobotics 10-11-2010 21:57

Re: How to rotate camera to target; motor to the angle of the camera
 
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. :)

Whcirobotics


All times are GMT -5. The time now is 10:15.

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