Hello,
We recently switched from a mecanum drive to an arcade drive in C++. I built my code using robot builder than have been modifying it to behave the way I would like. When it built it used RobotDrive instead of DifferentialDrive which gives an error saying to use DifferentialDrive instead because RobotDrive is deprecated.
So I have made the change to DifferentialDrive, and have made a SpeedControllerGroup for the left and right side to hand over to differential Drive. When I Hand it the TalonSRX speed controllers it throws an error saying there is no matching function call that allows for a talonSRX
Here is my RobotMap Code which is giving the error.
#include "RobotMap.h"
#include "LiveWindow/LiveWindow.h"
#include "ctre/Phoenix.h"
#include "WPILib.h"
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=INCLUDES
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=ALLOCATION
std::shared_ptr<WPI_TalonSRX> RobotMap::driveBaseSubfrontLeft;
std::shared_ptr<WPI_TalonSRX> RobotMap::driveBaseSubfrontRight;
std::shared_ptr<WPI_TalonSRX> RobotMap::driveBaseSubrearLeft;
std::shared_ptr<WPI_TalonSRX> RobotMap::driveBaseSubrearRight;
std::shared_ptr<SpeedControllerGroup> RobotMap::driveBaseSubleftSide;
std::shared_ptr<SpeedControllerGroup> RobotMap::driveBaseSubrightSide;
std::shared_ptr<DifferentialDrive> RobotMap::driveBaseSuba_drive;
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=ALLOCATION
void RobotMap::init() {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
//frc::LiveWindow *lw = frc::LiveWindow::GetInstance();
driveBaseSubfrontLeft.reset(new WPI_TalonSRX(10));
driveBaseSubfrontRight.reset(new WPI_TalonSRX(11));
driveBaseSubrearLeft.reset(new WPI_TalonSRX(12));
driveBaseSubrearRight.reset(new WPI_TalonSRX(13));
driveBaseSubleftSide.reset(new SpeedControllerGroup(driveBaseSubfrontLeft, driveBaseSubrearLeft));
driveBaseSubrightSide.reset(new SpeedControllerGroup(driveBaseSubfrontRight, driveBaseSubrearRight));
driveBaseSuba_drive.reset(new DifferentialDrive(driveBaseSubleftSide, driveBaseSubrightSide));
driveBaseSuba_drive->SetSafetyEnabled(true);
driveBaseSuba_drive->SetExpiration(0.1);
driveBaseSuba_drive->SetMaxOutput(1.0);
Alternatively I have tried to pass differential Drive the front left and front right talons and make the Rear talons slaves to their respective masters. This also gives an error in Differential Drive.
Thanks.