Autonomous Open Motor

If I have Autonomous and am using PWM 1 and 2 for my drive motors, and I want to start two rollers that are controlled by PWM 3 and 4, how do i open the reference in the Code, or do you have to link it from Basic Robot Main???

If you’re going to use it in both autonomous and in your basic robot main, you should publish the device reference as a global variable, like the RobotDriveDevRef is. See chapter 4 of the FRC Programming guide for instructions on how to do that.

Ok so since our robot is using 2 rollers to collect balls, i created to global refs for them…but when i try to wire it in labview it wont let me, it seems that you are not able to just use motor open. what am i doing wrong?

Autonomous Independent.vi (29.5 KB)
Basic Robot Global.vi (46.1 KB)


Autonomous Independent.vi (29.5 KB)
Basic Robot Global.vi (46.1 KB)

The variables you created in the Basic Robot Global are RobotDriveDevRefs, rather then the DevRefs from Motor Open. That’s why it’s giving you a type error.

Also, in the Autonomous Independent, your last Watchdog Delay and Feed doesn’t have the device reference wired.

Yes you will need to open them in the Begin.vi (if you are using the advanced framework, which it sounds like) and then Simply click on the MotorOpen.vi and copy the Robot DefRev and paste it into your robot data.ctl Go to the bundle and expand it by 1 or 2 or w.e, click the name, find the new PWM device and select all elements.

Down in your autonomous expand the Unbundle of the Robot Data In and select the PWM device and “All Elements” and use from there.

Be sure not to delete or copy the existing Controls or Indicators such as Global Data, Robot Data in/Out, Periodic Tasks, etc. Because deleting them will mess up the SubVis (Begin, Teleop, etc) and will require them to be remade into Subvis. Instead simply paste your new Device Refs into each control/indicator point.

If you need more help message me.
Jason

ok so i figured out how to create a global variable, but i am still not to get it inside of the loop. please take a look at my VI’s. Thanks!

Belt Roller Global.vi (33.2 KB)
Autonomous Independent.vi (29.3 KB)


Belt Roller Global.vi (33.2 KB)
Autonomous Independent.vi (29.3 KB)

Right click on the global variable and choose change to read.

i tried that but everytime i try to connect it to the motorcontroldevref, its breaks the wiring…i’m doing this in basic robot main by the way