[FTC]: RobotC Coasting Not Working

Hey Chief Delphi,

We are the Charging Champions, a six-member FTC team from SoCal. In our teleop program, we needed to coast our drive wheels (only) since the weight of our robot was causing it to fall backwards every time we stopped. However, after we enabled the bFloatDuringInactiveMotorPWM function for the drive motors, the other motors also started coasting. To prevent this from happening, we turned the function off for the other motors, and ALL of the motors (including the drive motors) stopped coasting.

Here is our code (Note that there are four motors for driving and two for other things):

#pragma config(Hubs,  S1, HTMotor,  HTMotor,  HTServo,  HTMotor)
#pragma config(Motor,  mtr_S1_C1_1,     rightTopDrive, tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,     rightBottomDrive, tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_1,     brush,         tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_2,     pulley,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C4_1,     leftBottomDrive, tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C4_2,     leftTopDrive,  tmotorTetrix, openLoop, reversed)
#pragma config(Servo,  srvo_S1_C3_1,    basket,               tServoStandard)
#pragma config(Servo,  srvo_S1_C3_6,    brushUpAndDown,       tServoStandard)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c" //call joystick functions
task main()
{
  waitForStart();
	getJoystickSettings(joystick); //call the function
	servo[basket] = 15; // servo basket at 15 degrees

	while(true) //constantly check for the joystick input
	{
		if(abs(joystick.joy1_y1) > 10)// if the absolute value of the left joystick in Joystick 1 is greater than 10
  	{
  		motor[leftBottomDrive] = joystick.joy1_y1 * 25/127;// the left-back wheel drives at power 25
  		motor[leftTopDrive] = joystick.joy1_y1 * 25/127;// the left-front wheel drives at power 25
  	}
  	else
  	{
  		bFloatDuringInactiveMotorPWM = true;
  		motor[leftBottomDrive] = 0;//left-back wheel does not move
  		bFloatDuringInactiveMotorPWM = true;
  		motor[leftTopDrive] = 0;//left-front wheel does not move
  	}
  	if(abs(joystick.joy1_y2) > 10)// of the absolute value of the right joystick in Joystick 1 if greater than 10
  	{
  		motor[rightBottomDrive] = joystick.joy1_y2 * 25/127 ;// the right-back wheel drives at power 25
  		motor[rightTopDrive] = joystick.joy1_y2 * 25/127;// the right-front wheel drives at power 25
  	}
  	else
  	{
  		bFloatDuringInactiveMotorPWM = true;
  		motor[rightBottomDrive] = 0;//right-back wheel does not move
  		bFloatDuringInactiveMotorPWM = true;
  		motor[rightTopDrive] = 0;//right-front wheel does not move
  	}
  	
  	if(joy2Btn(4) == 1 || joy1Btn(4) == 1) //if joystick button Y is pressed
  	{
  		motor[brush] = 70;// brush will spin at power 70
  	}
  	else
  	{
  		bFloatDuringInactiveMotorPWM = false;
  		motor[brush] = 0; //motor will not spin
  	}

  	if(joy2Btn(5) == 1) //if Joystick button LB is pressed
  	{
  		servo[brushUpAndDown] = 255;// brush goes up the arm
  	}
  	else if(joy2Btn(6) == 1)// if Joystick button RB is pressed
  	{
  		servo[brushUpAndDown] = 0;// brush goes down the arm
  	}
  	if(joystick.joy2_TopHat == 0)// if the "North" button on Tophat is pressed
  	{
  		servo[basket] = 230;// basket lifts up
  	}
  	if(joystick.joy2_TopHat == 4)//if the "South" button on Tophat is pressed
  	{
  		servo[basket] = 115;// basket drops down
  	}
  	if(abs(joystick.joy2_y1) > 5 && abs(joystick.joy2_y2) > 5)// if the absolute value of both joysticks in Joystick 2 is greater than 5
  	{
  		motor[pulley] = (joystick.joy2_y1 + joystick.joy2_y2) * 25/128;//pulley goes up and down
  	}
  	else
  	{
  		bFloatDuringInactiveMotorPWM = false;
  		motor[pulley] = 0;// pulley does not go up or down
  	}
    }
}

Did we use the bFloatDuringInactiveMotorPWM function incorrectly? If so, what is the correct way to use?

All help is appreciated. Go FTC TEAMS!!!

Thanks,
The Charging Champions

Are there any alternatives to using bFloatDuringInactiveMotorPWM since this feature turns coasting on or off for the whole program (not for each specific motor)

All help is appreciated.

Thanks,
The Charging Champions

Based off of the motor controller specifications, a value of -128 sets the motor to off/float instead of off/brake. I have not tested this though.