Go to Post You are becoming the leaders of tomorrow by leading today. - Chris Fultz [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 02-18-2010, 09:10 PM
dan_h dan_h is offline
EE Grad Student
AKA: Dan Huizenga
#0518
Team Role: College Student
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Grand Rapids, MI
Posts: 20
dan_h is an unknown quantity at this point
Help! Can't get PWMs to work...

I'm trying to get our control system working, and everything seems to be communicating properly (diagnostics shows communication, robot code, stop button, left stick, enet link, ds radio, bridge, and robot as all green), and when I enable the robot in teleop the RSI light switchs to long on/ short off, however, output to the PWMs doesn't seem to be working. Our robot code is as follows:

Code:
#include "WPILib.h"

class DefaultRobot : public SimpleRobot
{
	RobotDrive *myRobot;			// robot drive system
	Joystick *rightStick;			// joystick 1 (arcade stick or right tank stick)
	DriverStation *ds;				// driver station object

public:
	/**
	 * 
	 * 
	 * Constructor for this robot subclass.
	 * Create an instance of a RobotDrive with left and right motors plugged into PWM
	 * ports 1 and 2 on the first digital module.
	 */
	DefaultRobot(void)
	{
		ds = DriverStation::GetInstance();
		myRobot = new RobotDrive(1, 2, 3, 4);	// create robot drive base
		rightStick = new Joystick(1);			// create the joysticks
		//Update the motors at least every 100ms.
		GetWatchdog().SetExpiration(100);
	}

	/**
	 * Drive left & right motors for 2 seconds, enabled by a jumper (jumper
	 * must be in for autonomous to operate).
	 */
	void Autonomous(void)
	{
		GetWatchdog().SetEnabled(false);

		myRobot->Drive(0.5, 0.0);			// drive forwards half speed
		Wait(2000);							//    for 2 seconds
		myRobot->Drive(0.0, 0.0);			// stop robot

		GetWatchdog().SetEnabled(true);
	}

	void OperatorControl(void)
	{
		Jaguar temp(5);
		
		temp.Set(1.0); /* Expect, at the least, to see PWM5 on slot 4 move */
		
		while (IsOperatorControl())
		{
			GetWatchdog().Feed();
			myRobot->ArcadeDrive(rightStick);  // drive with arcade style (use right stick)
		}
	}
};

START_ROBOT_CLASS(DefaultRobot);
At the very least, I would expect to see PWM5 move. I also tried adding a printf to show the location of the joystick Y axis (through the target console in the debugger), and it updated as expected. Any help would be greatly appreciated!
__________________
--
Team 518 Home Page
Reply With Quote
 


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
Can't get program to execute Thxe C/C++ 3 02-09-2009 08:33 AM
CANT GET THE CANERA CODE TO WORK!!!! plz HELP!! its da PAT!!! Programming 3 02-18-2007 11:07 PM
Can't get EDU RC to print things. devicenull Programming 2 01-29-2006 04:42 PM
can't get R/C controller to work with EDUbot sweet-chan Robotics Education and Curriculum 2 03-04-2005 01:35 AM
Why can't we get along? Sean_330 General Forum 23 03-19-2003 09:38 PM


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

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