Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Help! Can't get PWMs to work... (http://www.chiefdelphi.com/forums/showthread.php?t=83045)

dan_h 18-02-2010 21:10

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!

Racer26 19-02-2010 12:24

Re: Help! Can't get PWMs to work...
 
Do you have 12V wired into the sidecar through the WAGO connector? are all three lights at the bottom of the sidecar on, is the sidecar connected to the DIO module in slot 4 on your cRIO?

dan_h 19-02-2010 20:54

Re: Help! Can't get PWMs to work...
 
Quote:

Originally Posted by 1075guy (Post 923883)
Do you have 12V wired into the sidecar through the WAGO connector? are all three lights at the bottom of the sidecar on, is the sidecar connected to the DIO module in slot 4 on your cRIO?

12V -> Yes, lights -> On, Sidecar connected to slot 4 -> Yes

In addition, the expected pattern blinks on the RSI light.

Interestingly, the dashboard shows now change in the PWM output level, which leads me to believe that it's probably not a connection problem, and more likely a software problem ... it's just that I can't find anything that's out of place. I'm going to try formatting and reflashing the cRio tomorrow, because I'm out of ideas.


All times are GMT -5. The time now is 13:27.

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