View unanswered posts | View active topics It is currently Sat Apr 30, 2016 10:57 pm






Reply to topic  [ 2 posts ] 
Roaming Robot 
Author Message
Rookie

Joined: Thu Feb 25, 2016 7:17 pm
Posts: 1
Post Roaming Robot
As a side job for our robotics club, we have "built" a disgrace of a robot. This bot consists of 6 wheels (2 are attached by zipties on the back of the bot) 0 wheels have two points of contact, and its just over garbage. Our code is (not worthy of this next statement) semi-decent. Here is our code:

Code:
#pragma platform(VEX)

//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)

#include "Vex_Competition_Includes.c"   //Main competition background code...do not modify!

/////////////////////////////////////////////////////////////////////////////////////////
//
//                          Pre-Autonomous Functions
//
// You may want to perform some actions before the competition starts. Do them in the
// following function.
//
/////////////////////////////////////////////////////////////////////////////////////////

void pre_auton()
{
  // Set bStopTasksBetweenModes to false if you want to keep user created tasks running between
  // Autonomous and Tele-Op modes. You will need to manage all user created tasks if set to false.
  bStopTasksBetweenModes = true;

   // All activities that occur before the competition starts
   // Example: clearing encoders, setting servo positions, ...
}

/////////////////////////////////////////////////////////////////////////////////////////
//
//                                 Autonomous Task
//
// This task is used to control your robot during the autonomous phase of a VEX Competition.
// You must modify the code to add your own robot specific commands here.
//
/////////////////////////////////////////////////////////////////////////////////////////

task autonomous()
{
  // .....................................................................................
  // Insert user code here.
  // .....................................................................................

   AutonomousCodePlaceholderForTesting();  // Remove this function call once you have "real" code.
}

/////////////////////////////////////////////////////////////////////////////////////////
//
//                                 User Control Task
//
// This task is used to control your robot during the user control phase of a VEX Competition.
// You must modify the code to add your own robot specific commands here.
//
/////////////////////////////////////////////////////////////////////////////////////////

task usercontrol()
{
   // User control code here, inside the loop

   while (true)
   {motor (port2)= vexRT (Ch2);//Right Wheels
         motor (port3) = vexRT (Ch2);//Right Wheels
         motor (port4)= vexRT (Ch3);//Left Wheels
         motor (port5) = vexRT (Ch3);//Left Wheels
         
     // This is the main execution loop for the user control program. Each time through the loop
     // your program should update motor + servo values based on feedback from the joysticks.



Our goal is to have a robot that using one ultrasonic ranger finder, will roam through our school, turning and going in another direction when it finds an obstacle. We need help getting our ultrasonic range finder working. It would be appreciated if anyone would get us a program that would do this for us! Thanks.


Thu Feb 25, 2016 7:27 pm
Profile
Expert

Joined: Thu Dec 01, 2011 12:07 am
Posts: 127
Post Re: Roaming Robot
You are missing two } shown below.
Maybe you did not post all of your code.
Code:
task usercontrol()
{
   // User control code here, inside the loop

   while (true)
   {
      motor (port2)= vexRT (Ch2);//Right Wheels
      motor (port3) = vexRT (Ch2);//Right Wheels
      motor (port4)= vexRT (Ch3);//Left Wheels
      motor (port5) = vexRT (Ch3);//Left Wheels
   }

   // This is the main execution loop for the user control program. Each time through the loop
   // your program should update motor + servo values based on feedback from the joysticks.
}


Sat Feb 27, 2016 7:49 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.