Unused Subsystem.

We made an unused subsystems for our shooting motor (that will connect once the shooting mechanism is finished), the .h file for the shooting motor is below:

#ifndef ShootingMotor_H
#define ShootingMotor_H

//Including the files in order to get the class
#include <Commands/Subsystem.h>
#include <Talon.h>

//Creating the class of shooting motor
class ShootingMotor : public Subsystem {
        //Creating a talon object pointing toward the 0 pwm port
	frc::Talon shootingMotor{ 0 };

        //Creating public function
	void InitDefaultCommand() override ;

        //Creating a method for setting the speed of the motor
	* @param Speed in range -1,1]

	void setSpeed(double speed);

#endif  // ShootingMotor_H

The thing is that there is no motor controller connect to the pwm port 0 at the moment. When we deploy the code through eclipse, it work normally but when viewing through Driver station, the ds perceive that there is no robot code and the comm light on the roborio is solid red. Does this happen because we have an unused subsystem pointing toward an empty pwm port?

I’m more familiar with Java, but I do know that if you try to instantiate an object with a PWM port that has assigned elsewhere, it does the same thing and crashes. Have you tried removing the subsystem?

Nothing needs to be connected to any PWM ports.

The code is crashing for other reasons.
I presume this problem was solved long ago…

No; the RIO receives no feedback from a PWM port, not even to the level of knowing whether there is a device at the other end.

Try Instantiating your Talon object in your constructor, you want to make sure you instantiate any objects used in your subsystem in the constructor. This way, those resources are only being allocated when your constructor is called and not as soon as the program starts. Not sure if you knew, but it’s good practice to only instantiate your objects in the constructor, since the resources only get allocated when this class get instantiated and is ready to use.