"Allocating channel or module that is out of range"

I recently attempted to code pnuematics and I get this strange error in the console when i run C++ code in WindRiver


What i think is the problem is that my solenoid module is inserted in module 6. However, the default is 8. If it is in module 6, then the lights turn on. Otherwise, they do not turn on.

I have tried basically everything I can think of, yet it has not solved the problem.

I have also commented out the solenoid code in an effort to get Joystick input, but that does not work either.

Any help is appreciated.

The WPI Library expects that the solenoid module is in slot 8, and only slot 8. You might be able to make it work by changing the modulePopulation constant in SensorBase.cpp to have a 9472 module selected at the desired index.

I don’t see any specific rules against doing this, but I also don’t quite understand why you’d need to move it to slot 6.

Not only does the WPILib code assume slot eight, but more importantly so does the FPGA.

Greg McKaskle

specifically how can i do that?

it just happened to be in slot 6 at the time and it turned on …

I was actually just wondering that after looking into the source code further. Thanks for verifying it.

It looks like you’ll have no choice but to use slot 8.

I still get this error when plugged into slot 8 and no lights turn on on the module

If you still see that error on slot 8, it’s probably because you may have forgot to make this change in the code when allocating a Solenoid object. If this isn’t it, posting your code may help us help you.

Unfortunately, I don’t think I can help very much with the lights not turning on.

make what change?

I’m assuming that when you were trying to use slot 6, you had code that may have looked something like this:

Solenoid *s = new Solenoid(6, 1);

However, when you tried out module 8 again, you didn’t change that. If you try to use a slot other than 8 in the software, it will generate that fatal error. Since by default module 8 is selected, the simplest thing to do is only provide one parameter: the channel number.

Solenoid *s = new Solenoid(1);

I tried that and I still got the error. I also unplugged the slot and commented out all solenoid code and still got the error =(

We’ve found a solution

We discovered the code wasn’t compiling properly, so after we deleted the PPC603gnu folder, it began compiling again. This removed the error.

Secondly we plugged in the solenoid module into module 8. Initially I didn’t think it needed power, but it actually did, so we hooked up a wago connector to it in 12v input on the power dist. board and everything was working

2012-version thread resurrection

We are getting this from our cRio when running the SimpleTemplate sample code:

>>>>>ERROR: Allocating module that is out of range or not found: Digital Module 1 …in InitPWM() in C:/WindRiver/workspace/WPILib/PWM.cpp at line 33

We tried the RobotDrive(SpeedController&, SpeedController&, SpeedController&, SpeedController&) constructor with our own Jaguar classes and we got the error for each SpeedController that we constructed. We got it with just the basic RobotDrive(int,int) constructor (it chooses slot 1 as a default, and errors out).

Do you have a Digital Module in slot 2 of your cRIO?

Watch out for a difference in numbering systems this year. It’s not the cRIO “slot” that’s important to the code. The “module number” is going to be 1 for the first Analog module (in slot 1), the first Digital module (in slot 2), and the [optional] first Solenoid module (in slot 3). On a 4-slot cRIO-II, the [optional] module in slot 4 is number 2; on an 8-slot cRIO, the [optional] modules in slots 5-7 are number 2.

Excellent, we will try that at our next opportunity. Do you know where the documentation is for that change?

Edit: Found it. We had glossed over the “setting up the control system” section because it said veteran teams were probably good to go with an old robot.