|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
No Robot Code
We are trying to add code to read the PWM of our Victors to find our deadband for our Victor class bounds. The code's written, added to the robot code, but the Driver Station tells us there's no code while the PWM reading code is in the code. We have deployed the code to the cRIO and have all the electronics set up. Here's the code:
PWMReader.h: #ifndef TEAM3138_PWMREADER_H #define TEAM3138_PWMREADER_H #include <WPILib.h> #include <SmartDashboard/SmartDashboard.h> #include <PWM.h> class PWMTester : public PWM { public: explicit PWMTester(UINT32 channel); PWMTester(UINT8 moduleNumber, UINT32 channel); virtual ~PWMTester(); void Update(); private: }; #endif PWMReader.cpp: #include "PWMReader.h" PWMTester: WMTester(UINT32 channel) : PWM(channel){ } PWMTester: WMTester(UINT8 moduleNumber, UINT32 channel) : PWM(UINT8 moduleNumber, UINT32 channel){ } And all we added to the Robot code was the line: dash->PutNumber("PWM Output", m_PWMTester.GetRaw()); to print to the dashboard so that we can read the values off the screen. GetRaw() is found in PWM.h in WPILib. |
|
#2
|
|||
|
|||
|
Re: No Robot Code
The smilies shouldn't be there. They should be a colon P.
|
|
#3
|
|||
|
|||
|
Re: No Robot Code
Please use the code button when posting code snippets... Try removing the dash->putnumber (and potentially replacing it with a printf). Sometimes interacting with smart dashboard crashes the robot code.
Last edited by agartner01 : 17-01-2013 at 20:34. |
|
#4
|
|||
|
|||
|
Re: No Robot Code
#ifndef TEAM3138_PWMREADER_H
#define TEAM3138_PWMREADER_H #include <WPILib.h> #include <SmartDashboard/SmartDashboard.h> #include <PWM.h> class PWMTester : public PWM { public: explicit PWMTester(UINT32 channel); PWMTester(UINT8 moduleNumber, UINT32 channel); virtual ~PWMTester(); void Update(); private: }; #endif #include "PWMReader.h" PWMTester: WMTester(UINT32 channel) : PWM(channel){ } PWMTester: WMTester(UINT8 moduleNumber, UINT32 channel) : PWM(UINT8 moduleNumber, UINT32 channel){ } dash->PutNumber("PWM Output", m_PWMTester.GetRaw()); |
|
#5
|
|||
|
|||
|
Re: No Robot Code
Code:
#ifndef TEAM3138_PWMREADER_H
#define TEAM3138_PWMREADER_H
#include <WPILib.h>
#include <SmartDashboard/SmartDashboard.h>
#include <PWM.h>
class PWMTester: public PWM {
public:
explicit PWMTester(UINT32 channel);
PWMTester(UINT8 moduleNumber, UINT32 channel);
virtual ~PWMTester();
void Update();
private:
};
#endif
#include "PWMReader.h"
PWMTester:WMTester(UINT32 channel) : PWM(channel)
{
}
PWMTester:WMTester(UINT8 moduleNumber, UINT32 channel) : PWM(UINT8 moduleNumber, UINT32 channel)
{
}
dash->PutNumber("PWM Output", m_PWMTester.GetRaw());
Last edited by agartner01 : 17-01-2013 at 20:35. |
|
#6
|
|||
|
|||
|
Re: No Robot Code
Okay. I'm new to Chief Delphi. So, do you have an answer?
|
|
#7
|
|||
|
|||
|
Re: No Robot Code
Try removing the dash->putnumber (and potentially replacing it with a printf). Sometimes interacting with smart dashboard crashes the robot code. Also look at the netconsole/ WTX console output for errors.
Edit: as I look at it again, dash-> put number is never actually called. You have to put it in a function/constructor. I think you want: Code:
void PWMTester::Update
{
dash->PutNumber("PWM Output", m_PWMTester.GetRaw());
}
Last edited by agartner01 : 17-01-2013 at 20:54. |
|
#8
|
|||
|
|||
|
Re: No Robot Code
The problem is that we're trying to read the output values from smart dashboard. I'd like to try to get it to work with it, but I'll try.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|