Announcement

Collapse
No announcement yet.

Why motor.setChannelMode() ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why motor.setChannelMode() ?

    disclaimer... OK, yes, it's true, I'm a pedantic programmer...

    Every time I work with a new programmer and introduce them to their first opMode, I stumble over the setChannelMode() method associated with a dcMotor object.

    I know where the "channel" part comes from... it's needed to setting the mode of a motor when using the dcMotorController object (as it has two possible channels).
    So in that instance, you need to identify the correct channel number.

    eg: myMotorController.setChannelMode(channel, mode);

    But why does the word "channel" appear when I'm setting the mode directly through a dcMotor object.

    Shouldn't it just be myMotor.setMode(mode) ? Since there is no mention of a "channel" in the dcMotor object the use of the word is not only unnecessary, it's confusing.

    I understand that in some underlying code, it may be relevant, but it's not apparent to the user.

    We don't have myMotor.setChannelDirection(), or myMotor.setChannelPower() , yet are all part of the same motor control function.

    I know at this point it would break a lot of people's code to fix this. But if it's not fixed now, it will haunt us forever.

    Question:
    Even thought the "mod"e enumerators effect individual motors, they belong to the dcmotorcontroller object.
    Is this because of the whole Legacy Read/Write issue?

    Phil.

  • #2
    Thanks for pointing this out. I don't want to break anyones existing code, but I'll add the new methods at minimum and probably mark the old ones as deprecated.

    Comment


    • #3
      Originally posted by Jonathan Berling View Post
      Thanks for pointing this out. I don't want to break anyones existing code, but I'll add the new methods at minimum and probably mark the old ones as deprecated.
      Excellent. Thanks.

      Phil.

      Comment

      Working...
      X