Announcement

Collapse

Technology Forum Has Moved!

The FIRST Tech Challenge Technology forum has moved to a new location! Please take a look at our forum blog for links and instructions on how to access the new forum.

The official blog of the FIRST Tech Challenge - a STEM robotics programs for students grades 7-12.


Note that volunteers (except for FTA/WTA/CSA will still access their role specific forum through this site. The blog also outlines how to access the volunteer forums.
See more
See less

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
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎