Go to Post Students... be sure to drill air holes in the crate though. Maybe toss in some cheetos for the programmers. - Andrew Schreiber [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-02-2009, 18:20
Thxe Thxe is offline
Registered User
FRC #2535
 
Join Date: Jan 2009
Location: Tigears
Posts: 17
Thxe is an unknown quantity at this point
Robot seems to be Disabled when using Jaguars

ok, I am writing my first basic program for the robot. I know the robot is in functioning order because i can load and run the Simple Template and that works. Unfortunatly when I run my program, nothing happens. I know that values are being read in from the joystick because I have some printfs and the console. Here is the weird thing, even while the robot is enabled, the signal light continues to blink like its in disabled mode. When I use the Simple Template, the light works correctly.

Here is the relevant code:
Code:
class Robot : public IterativeRobot
{
    Jaguar *leftDrive;
    Jaguar *rightDrive;
    Joystick *stick;

public:
  void RobotInit(void)
  {
    printf("RobotInit:\n");
    leftDrive = new Jaguar(4, 1);
    rightDrive = new Jaguar(4, 2);
    GetWatchdog().SetExpiration(0.1);
  }

  void TeleopPeriodic()
  {
    printf("TeleopPeriodic:\n");
    drive();
  }

  void drive()
  {
    float joyX = stick->GetX();
    float joyY = stick->GetY();
    float leftPower;
    float rightPower;

    printf("joyX: %f\n", joyX);
    printf("joyY: %f\n", joyY);
    rightPower = joyY;
    leftPower = joyY;
    printf("rightPower: %f\n", rightPower);
    printf("leftPower: %f\n", leftPower);
    rightDrive->Set(rightPower);
    leftDrive->Set(leftPower);
    printf("rightDrive: %f\n", rightDrive->Get());
    printf("leftDrive: %f\n", leftDrive->Get());
  }
};

START_ROBOT_CLASS(Robot);
Here is a relevant section from the console:
Code:
TeleopPeriodic:
joyX: 0.000000
joyY: -0.476563
rightPower: -0.476563
leftPower: -0.476563
rightDrive: -0.476563
leftDrive: -0.476563
It seems to me that the code is working correctly, has anybody seen this business with the signal light showing disabled while the robot is enabled? I believe that this is the problem. Any ideas are welcome.

Thxe
Reply With Quote
  #2   Spotlight this post!  
Unread 11-02-2009, 21:59
Thxe Thxe is offline
Registered User
FRC #2535
 
Join Date: Jan 2009
Location: Tigears
Posts: 17
Thxe is an unknown quantity at this point
Re: Robot seems to be Disabled when using Jaguars

Ok, I found the problem myself. I wasn't feeding the watch dog! It should be noted that the watch dog does not stop your code from executing, it only prevents commands to motors and such from going through, with no error messages at all! So if you see your signal light doing the disabled blink while your robot is enabled, it may be because the watch dog timed out.

Thxe
Reply With Quote
  #3   Spotlight this post!  
Unread 11-02-2009, 22:01
MattD's Avatar
MattD MattD is offline
Registered User
AKA: Matthew Douglas
FRC #0228 (GUS Robotics)
Team Role: Alumni
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Indianapolis, IN
Posts: 185
MattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to behold
Send a message via AIM to MattD
Re: Robot seems to be Disabled when using Jaguars

It looks like this is because the watchdog is not being fed, so the motor outputs are disabled. Add in GetWatchdog().Feed() to your teleop function and it should work.
__________________
GUS Robotics Team 228

2010 WPI Engineering Inspiration Award
2010 WPI Regional Champions (Thanks 230 & 20!)
2010 CT VEX Champions
2010 CT VEX Innovate Award
2009 QCC VEX Champions
2009 CT Motorola Quality Award
2007 CT J&J Sportsmanship Award
2006 CT Best Website Award
Reply With Quote
Reply


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
Disabled Robot Scoring? DM7000 Rules/Strategy 15 09-01-2009 21:50
Question: Can robot block lower goals to prevent scoring? Seems unfair. 456RoboChick Rules/Strategy 1 11-01-2006 20:04
using SCORBOT for disabled people kandyuee Robotics Education and Curriculum 2 16-04-2004 07:31


All times are GMT -5. The time now is 14:52.

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