Go to Post When I got home from work my facebook wall had exploded with people chanting the names of dead scientists. Did someone say culture change? :cool: - Ian Curtis [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-02-2007, 15:40
The yellowdart's Avatar
The yellowdart The yellowdart is offline
Registered User
FRC #1506 (Metal Muscle)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Oakland County
Posts: 22
The yellowdart has a little shameless behaviour in the past
Camera Code Help Please

We cant figure out why the distance is not correct. We have the light at 4 ft and the camera is 15.5 inches off the ground. We used the equation, and it is giving us strange answers. Any help of ideas would be appeciated

---------------------------------------------------------------------

#include <stdio.h>
#include "ifi_aliases.h"
#include "ifi_default.h"
#include "camera.h"
#include "tracking.h"
#include "math.h"

void Tracking_Info_Terminal(void)
{
static unsigned char i = 0;
static unsigned char j = 0;
static unsigned int old_camera_t_packets = 0;
static unsigned int distance_woota = 0 ;
// has a new camera tracking packet arrived since we last checked?
if(camera_t_packets != old_camera_t_packets)
{
// increment the t-packet counter
i++;

distance_woota = (33/(tan(((TILT_SERVO - 144) * 25)/50)));

// reset the "no camera data" loop counter
j = 0;

// only show data on every twenty t-packets
if(i >= 20)
{
// reset the local t-packet counter
i = 0;

// does the camera have a tracking solution?
if(Get_Tracking_State() == SEARCHING)
{
printf("Searching...\r\n");
}
else
{
printf("\r\n");

// pan angle = ((current pan PWM) - (pan center PWM)) * degrees/pan PWM step

printf(" Pan Angle (degrees) = %d\r\n", (((int)PAN_SERVO - 144) * 65)/124);

// tilt angle = ((current tilt PWM) - (tilt center PWM)) * degrees/tilt PWM step

printf("Tilt Angle (degrees) = %d\r\n", (((int)TILT_SERVO - 144) * 25)/50);

printf(" Pan Error (Pixels) = %d\r\n", (int)T_Packet_Data.mx -

Tracking_Config_Data.Pan_Target_Pixel);

printf("Tilt Error (Pixels) = %d\r\n", (int)T_Packet_Data.my - Tracking_Config_Data.Tilt_Target_Pixel);

printf(" Blob Size (Pixels) = %u\r\n", (unsigned int)T_Packet_Data.pixels);

printf("Confidence (Pixels) = %u\r\n", (unsigned int)T_Packet_Data.confidence);

printf("DiStAnCe HAHAHHA = %d\r\n", (int) distance_woota);

------------------------------------------------------------------------

Any ideas would be greatly appreciated.
  #2   Spotlight this post!  
Unread 10-02-2007, 15:45
Eclipse's Avatar
Eclipse Eclipse is offline
Registered User
AKA: Sensei Hanzo
FRC #1250 (Gatro-Bots)
Team Role: Programmer
 
Join Date: Feb 2006
Rookie Year: 2004
Location: Dearborn, MI
Posts: 18
Eclipse is an unknown quantity at this point
Re: Camera Code Help Please

Here are a couple things you could try:
1. Are you sure the value you're passing to tan() is in radians as opposed to degrees?
2. Try typecasting the assignment to distance_woota as an int.
__________________
xXx.S3nS31-h4nz0.xXx
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Camera servos too slow, help please Lablabla Programming 9 19-01-2007 11:59
Premiere won't recognize camera - please help sanddrag IT / Communications 9 04-01-2007 20:17
please help me to plag in the camera CompMaster Programming 1 16-02-2006 11:24
HELP US PLEASE?!?!(pressure switch code) kingpin3787 General Forum 1 21-02-2004 15:13
hey need some help with writing a code please help me here magical hands Programming 9 01-01-2004 21:46


All times are GMT -5. The time now is 02:50.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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