Getting Autonomous mode and Tele-op to work

Home FTC South Africa Forum FTC RobotC Discussions Getting Autonomous mode and Tele-op to work

This topic contains 1 reply, has 2 voices, and was last updated by  liezelt@pureau.co.za 2 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #37

    MegaBotz
    Participant

    Hi there teams!

    We, MegaBotz, were battling to figure out how to get the Autonomous and Tele-op modes to work – both templates in RobotC looked the same to us and we were lost. We contacted a team from the US, Cafebots and they were super eager to help us with our problem. Brandon sent us the following and I am sure it will help all of you as well : (The Program-Chooser.c file can be downloaded here)

    For the Autonomous and Teleop programs, you can use either one file (with both programs in it) or two files. Our team prefers to use two files, titled Teleop.c and Autonomous.c respectively, so I will proceed along that train of thought.

    In the two file case, both files use an identical template, just with different code after the waitForStart() function:

    #PRAGMAS

    void initialize()
    {

       //Do stuff.
    }

    task main()
    {

       initialize();
       waitForStart();
       while (isEnabled())
       //Tele-op/Autonomous code.
    }

    Once you have these two files created and compiled, you will need to download a third file to your robot called Program-Chooser.c.  It’s supposed to be included with RobotC, but even the veteran teams were having trouble finding where it was located (File can be downloaded at the top of this discussion)

    Once this file is downloaded to your robot, run it on the NXT manually.

    • You will now see a screen on the NXT that says something like "Single or Dual file".  Select Dual File.
    • You should now see a screen asking for the file. Navigate to your Tele-Op file and select it.

    With that, you should be all set for competition!  When you place the robot out on the field, select and start running the Autonomous program first; the FCS will automatically stop it and start the Tele-Op program at the end of Autonomous.  You should re-select the Tele-Op file on the NXT every time you change it, just to be safe.

    • This topic was modified 2 years, 10 months ago by  MegaBotz.
    • This topic was modified 2 years, 10 months ago by  MegaBotz.
    #44

    Cool Thanks. We will also work on this.
    Magic Matrix

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.