View Single Post
  #4   Spotlight this post!  
Unread 30-12-2009, 20:18
vhcook's Avatar
vhcook vhcook is offline
Reader of Things
AKA: Victoria
FRC #1939 (Kuh-nig-its)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Kansas City, MO
Posts: 546
vhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond repute
Re: New Programmer looking for some help!

It looks like you're using the advanced framework. I'm assuming you're starting from scratch rather than modifying a pre-existing program (please correct me if I'm wrong on either of these points).

By default, unless you've changed it, the advanced framework opens two motors on Slot 4/PWMs 1 and 2 in Begin.vi and feeds them into the RobotDriveDevRef device reference within the main RobotData cluster that shows up everywhere. (which you see coming back out on the left of your AutonomousIterative screen there). Opening two more motors in AutonomousIterative and assigning them to the same PWM locations is likely to result in problems. It's generally a good idea to do all your motor and sensor opens in Begin.vi, and your closes in Finish.vi so that everything stays organized.

Also, Autonomous Iterative runs every tick (about 20ms if I remember right) during Autonomous mode rather than running exactly once. What you're doing here will cause the motor to open and set its speed repeatedly, which is not going to go well. At a recent workshop here, our NI guy indicated they'd seen teams have a lot of problems if they tried to open a motor that was already open (such as cRIO locks up and requires a reboot of the whole robot to go again). For this, I'd recommend Autonomous Independent, which runs exactly once during Autonomous mode.

Two things you need to do to make this work that you may not know about are setting the Autonomous Style to Independent in Begin.vi (the enum dropdown is already there for you - just set appropriately), and setting the T/F toggle outside the case statement in Autonomous Independent to T (a F setting disables the Autonomous code in that file).

The cleanest way I found of moving device references around between sections of the advanced framework is to add the reference to the RobotData.ctl typedef and then use the bundle and unbundle by name cluster functions to get the appropriate references in and out of the RobotData Cluster. If you're just wanting to deal with a basic two motor drive, the default code has the the reference built in, and an unbundle already sitting there for you for the two drive motors, and you'd use the appropriate RobotDrive (arcade, tank, or holonomic) VI from the WPI library functions to set your speeds.

If you'd like me to work with you a bit on this, please PM me.
__________________


Reply With Quote