Go to Post To help keep the kids on top of their game, I remind them that the school board considers a grade of 97 an A , so we can lose 3% of the kids and still be considered excellent. - DonRotolo [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 22-02-2005, 02:48
Zalumaskov's Avatar
Zalumaskov Zalumaskov is offline
Premier
no team
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Place
Posts: 12
Zalumaskov is on a distinguished road
Slowing down Camera drive turning

How can I make it turn at a slower speed when tracking with the following code...

if (p1_sw_trig > 0 && tracking > 0) { //If vision active and tracking use camera data
p1_y = speed_control; //set forward speed
p1_x = pan_position; //set turning rate
p1_x = 255 - p1_x; //invert turn direction
// Steering Compensation
if (p1_x > 135 && p1_x < 225 && steering_comp > 0)
p1_x = p1_x + steering_comp;
if (p1_x < 120 && p1_x > steering_comp && steering_comp > 0)
p1_x = p1_x - steering_comp;
pwm11 = Limit_Mix(2000 + p1_y + p1_x - 127); //uses our ramp
pwm12 = Limit_Mix(2000 + p1_y - p1_x + 127); //uses our ramp
__________________
I would change the world but I don't have the source code.
  #2   Spotlight this post!  
Unread 27-02-2005, 10:11
kokodabear's Avatar
kokodabear kokodabear is offline
HELP!
AKA: Brady
#0686 (Bovine Intervention)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Frederick, MD
Posts: 13
kokodabear is an unknown quantity at this point
Send a message via AIM to kokodabear
Re: Slowing down Camera drive turning

Quote:
Originally Posted by Zalumaskov
How can I make it turn at a slower speed when tracking with the following code...

if (p1_sw_trig > 0 && tracking > 0) { //If vision active and tracking use camera data
p1_y = speed_control; //set forward speed
p1_x = pan_position; //set turning rate
p1_x = 255 - p1_x; //invert turn direction
// Steering Compensation
if (p1_x > 135 && p1_x < 225 && steering_comp > 0)
p1_x = p1_x + steering_comp;
if (p1_x < 120 && p1_x > steering_comp && steering_comp > 0)
p1_x = p1_x - steering_comp;
pwm11 = Limit_Mix(2000 + p1_y + p1_x - 127); //uses our ramp
pwm12 = Limit_Mix(2000 + p1_y - p1_x + 127); //uses our ramp
At top of file:
Code:
unsigned char slow_down = 10; // Change based on how slow you want
On the line before pwm11 = ...:
Code:
if (p1_x > 127 && p1_x - slow_down > 127)
   p1_x -= slow_down;
else if (p1_x < 127 && p1_x + slow_down < 127)
   p1_x += slow_down;
This will decrease the speed by slow_down. You could also limit the maximum turning rate. Ex: if p1_x > 140 then p1_x = 140
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
Scripting Setup and the Camera + Serial Port Drivers CJO Programming 22 11-01-2006 17:42
Autonomous Camera Integration GregC Programming 2 06-02-2005 14:34
Slowing Down Drive Motors Arc736UV Programming 5 24-01-2005 22:35
CMUCam2 Camera Code - Are important parts commented out? Mr. Lim Programming 4 14-01-2005 12:11
Swerve/crab drive and tank turning activemx Technical Discussion 9 23-02-2004 18:26


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

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