Go to Post And then the judges joined in and did the wave! - Basel A [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
  #5   Spotlight this post!  
Unread 22-01-2017, 21:04
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: CIM coders help!

In your example you are creating CANTalon objects, so the number in the constructor is actually the CAN ID and not a roboRIO port number. So that in itself should not be a conflict.

Code:
DriveCommand::DriveCommand() {
	victor = new Victor(0);
	victor2 = new Victor(1);
	talon = new CANTalon(1);
	talon2 = new CANTalon(2);
	CIM = new Encoder(0, 1, false, Encoder::EncodingType::k4X);
}
I'm wondering if the command is being created more than once, which would cause duplicate allocations which are indicated by your output:

Code:
ERROR -1029 HAL: Resource already allocated, Minimum Value: 0, Maximum Value: 20, Requested Value: 0 PWM [PWM.cpp:43] 
ERROR -1029 HAL: Resource already allocated, Minimum Value: 0, Maximum Value: 20, Requested Value: 1 PWM [PWM.cpp:43] 
ERROR -1029 HAL: Resource already allocated, Minimum Value: 0, Maximum Value: 31, Requested Value: 0 DigitalInput [DigitalInput.cpp:43] 
ERROR -1029 HAL: Resource already allocated, Minimum Value: 0, Maximum Value: 31, Requested Value: 1 DigitalInput [DigitalInput.cpp:43] 
ERROR -1098 HAL: A handle parameter was passed incorrectly InitEncoder [Encoder.cpp:43]
Ideally you would want to create the sensors and speed controllers in a subsystem rather than a command and refer to methods on the subsystem to actually operate the drive base. That way, creating multiple instance of commands won't double-allocate the sensors.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
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


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

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