Skip to content

Problem with simulated CANCoder #61

@Crossle86

Description

@Crossle86

I have wrapper classes for SRX & FX encoders. Cloned the FX encoder class to create to wrapper for CANCoder. The code that drives the sim updates:
` public void setSimValues(double position, double velocity)
{
simCollection.setRawPosition(metersToTicks(position));

	simCollection.setVelocity(velocityToTicks(velocity));
}

'

Reset is done with:
` public void reset()
{
ErrorCode errorCode;

	errorCode = encoder.setPosition(0);
	
	if (errorCode != ErrorCode.OK) 
		Util.consoleLog("encoder reset failed (%d) %s", errorCode.value, errorCode.name());
}

`
Running under sim, the absolute position works fine but the encoder count returned by get() is way out of whack. Start sim do no driving, just call for reset of encoder, the next (and all subsequent) get() returns a huge negative number. Then driving some does not change that value returned by get(). Note that I get this error on the reset() call:
encoder reset failed (-3) CAN_MSG_NOT_FOUND

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions