Quote:
Originally Posted by Arhowk
I don't know if the roboRIO does this but I know you couldn't with the sidecar because jaguars and talons/victors took different PWM wavelengths. The most intuitive would be something like this
Code:
robot.elevatorMotor = robot.pwm.port3
or, if you have to
Code:
robot.elevatorMotor = HAL.getMotor(3)
|
Correct, there isn't a way for the program to determine which type of PWM device is attached to it, so if you were to use this notation then the user would need to provide some declarative configuration that indicates what device is at which port.
The robot.pwm.* or robot.port* notation is interesting, but it's probably mostly useful for retrieving objects, instead of actively using them that way. Consider 'robot.arm_motor.set()' vs 'robot.pwm.port2.set()' -- if you ever change what port your arm motor is attached to, then you'll have to change it everywhere in code if you use the second notation everywhere.
However, it could be a more useful way to create these objects. Maybe something like robot.pwm.port2.createTalon('arm_motor') automatically creates a robot.arm_motor attribute.