Loading...
  Show Posts
Pages: [1] 2 3
1  Topics / Robotics / Re: Auto tennis ball shooter code help on: March 23, 2013, 09:38:25 am
I'll give that a try later tonight. If not, what else could it be?
2  Topics / Robotics / Auto tennis ball shooter code help on: March 22, 2013, 10:12:45 pm
The machine has a very odd behavior of instead of waiting for the VEX limit switch (http://www.vexrobotics.com/276-2174.html) to give the HIGH signal and spin the motors full forward for 5 seconds, it simply spins full forward immediately and if the limit switch is tripped for 5-6 seconds the motors stop till the switch is released. Anyone know whats wrong????

Code:
#include <Servo.h>

Servo Victor;


const int LimitSwitch = 2;


void setup()  // This runs once, at startup
{
  pinMode( LimitSwitch, INPUT);
  Victor.attach(9);
}


void loop()  // This loop runs over and over
{

  Victor.writeMicroseconds(1500); // Turn the shooter off


  if( digitalRead(LimitSwitch) == HIGH)  // If the limit switch is pressed
  {
     Victor.writeMicroseconds(2000); // Turn the shooter on
     delay (5000); // Timer for ball to shoot
  }


}
3  Topics / Robotics / Re: Autonomous tennis ball shooter on: March 17, 2013, 07:20:34 pm
Ok, so if I ditch the RobotOpen system and just use the arduino, can someone help me?? the program needs to wait for a signal from the VEX limit switch, and when the signal is received spin up the motors (Victor 888 for speed control) for 5 seconds, then shut off the motors and wait for the switch to trip again
4  Topics / Robotics / Autonomous tennis ball shooter on: March 15, 2013, 07:03:22 pm
My parents have requested a autonomous tennis ball shooting machine for our dogs when they'r home alone. My plan for it was to use the RobotOpen shield (http://www.team221.com/robotopen/product.php?id=105) and a FRC control system. It needs to detect a ball at the top of a ramp, and after the ball trips a limit switch at the top (http://www.vexrobotics.com/276-2174.html) spin up the motors for a preset amount of time (the time it takes the ball to roll down and get launched by the wheels, probably 3-5 seconds), then shut down the motors and await the next time the limit switch trips.

This is the tank drive RobotOpen program
Code:
#include <SPI.h>
#include <Ethernet.h>
#include <RobotOpen.h>


/* I/O Setup */
USBJoystick usb1('0');  // Assign the logitech USBJoystick object to bundle 0


void setup()
{
  /* Initiate comms */
  RobotOpen.begin();
}


/* This is your primary robot loop - all of your code
 * should live here that allows the robot to operate
 */
void enabled() {
  // Constantly update PWM values with joystick values
  RobotOpen.setPWM(SIDECAR_PWM1, usb1.makePWM(ANALOG_LEFTY, INVERT));
  RobotOpen.setPWM(SIDECAR_PWM2, usb1.makePWM(ANALOG_RIGHTY, NORMAL));
}


/* This is called while the robot is disabled
 * You must make sure to set all of your outputs
 * to safe/disable values here
 */
void disabled() {
  // PWMs are automatically disabled
}


/* This loop ALWAYS runs - only place code here that can run during a disabled state
 * This is also a good spot to put driver station publish code
 * You can use either publishAnalog, publishDigital, publishByte, publishShort, or publishLong
 * Specify a bundle ID with a single character (a-z, A-Z, 0-9) - Just make sure not to use the same twice!
 */
void timedtasks() {
  RobotOpen.publishAnalog(ANALOG0, 'A');   // Bundle A
  RobotOpen.publishAnalog(ANALOG1, 'B');   // Bundle B
  RobotOpen.publishAnalog(ANALOG2, 'C');   // Bundle C
  RobotOpen.publishAnalog(ANALOG3, 'D');   // Bundle D
  RobotOpen.publishAnalog(ANALOG4, 'E');   // Bundle E
  RobotOpen.publishAnalog(ANALOG5, 'F');   // Bundle F
}


/* This is the main program loop that keeps comms operational
 * There's no need to touch anything here!!!
 */
void loop() {
  RobotOpen.pollDS();
  if (RobotOpen.enabled())
    enabled();
  else
    disabled();
  timedtasks();
  RobotOpen.outgoingDS();
}

How can this be modified to allow for all the necessary tasks of a autonomous tennis ball shooter??????????
5  Using Arduino / Motors, Mechanics, and Power / Mecanum/Holonomic Drive on: February 19, 2013, 11:46:59 pm
My current project uses an Arduino Uno with Ethernet Shield and a RobotOpen shield (http://www.team221.com/robotopen/product.php?id=105) but they don't have Mecanum (sometimes called Holonomic) drive examples, only Tank, Swerve, and Arcade style drive systems. So this is the robots current Tank setup:
Code:
#include <SPI.h>
#include <Ethernet.h>
#include <RobotOpen.h>


/* I/O Setup */
USBJoystick usb1('0');  // Assign the logitech USBJoystick object to bundle 0


void setup()
{
  /* Initiate comms */
  RobotOpen.begin();
}


/* This is your primary robot loop - all of your code
 * should live here that allows the robot to operate
 */
void enabled() {
  // Constantly update PWM values with joystick values
  RobotOpen.setPWM(SIDECAR_PWM1, usb1.makePWM(ANALOG_LEFTY, NORMAL));
  RobotOpen.setPWM(SIDECAR_PWM2, usb1.makePWM(ANALOG_RIGHTY, NORMAL));
}


/* This is called while the robot is disabled
 * You must make sure to set all of your outputs
 * to safe/disable values here
 */
void disabled() {
  // PWMs are automatically disabled
}


/* This loop ALWAYS runs - only place code here that can run during a disabled state
 * This is also a good spot to put driver station publish code
 * You can use either publishAnalog, publishDigital, publishByte, publishShort, or publishLong
 * Specify a bundle ID with a single character (a-z, A-Z, 0-9) - Just make sure not to use the same twice!
 */
void timedtasks() {
  RobotOpen.publishAnalog(ANALOG0, 'A');   // Bundle A
  RobotOpen.publishAnalog(ANALOG1, 'B');   // Bundle B
  RobotOpen.publishAnalog(ANALOG2, 'C');   // Bundle C
  RobotOpen.publishAnalog(ANALOG3, 'D');   // Bundle D
  RobotOpen.publishAnalog(ANALOG4, 'E');   // Bundle E
  RobotOpen.publishAnalog(ANALOG5, 'F');   // Bundle F
}


/* This is the main program loop that keeps comms operational
 * There's no need to touch anything here!!!
 */
void loop() {
  RobotOpen.pollDS();
  if (RobotOpen.enabled())
    enabled();
  else
    disabled();
  timedtasks();
  RobotOpen.outgoingDS();
}

And my question is wether i could take the drive part out of Kiwi library's basic mecanum code

Code:
/* Kiwi drive macros and functions
 * By Jonathan M. Guberman, 2011
 * http://upnotnorth.net
 *
 * Use this code however you like, but don't blame me if it doesn't work!
 */

#include <Servo.h>

#define SPEED(x) (90 + (x))
#define DRIVE(x,y,z)   servo1.write(90 + (x)); servo2.write(90 + (y));servo3.write(90 + (z))
 
#define MAXSPEED 20
 
Servo servo1;
Servo servo2;
Servo servo3;
 
void setup()
{
 
}
 
 
void loop()
{

}

void setDrive(int angle, int maxspeed){
  float x = cos(3.14159 * (float) angle / 180);
  float y = sin(3.14159 * (float) angle / 180);
 
  DRIVE((int)(x*maxspeed),(int)((-0.5*x + 0.866*y)*maxspeed),(int)((-0.5*x-0.866*y)*maxspeed));
}

void setDrive(int angle){
  setDrive(angle, MAXSPEED);
}

void stopDrive(){
  DRIVE(0,0,0);
}

void stopDrive(int time){
  stopDrive();
  delay(time);
}

And copy & paste it into the RobotOpen code, replacing the tank drive bit. This possible? and where would the code be inserted?
6  Using Arduino / Displays / Re: Serial LCD help - newbie at programming on: November 29, 2012, 11:41:34 pm
Alright I'll see wether it can be incorporated in the steering wheel design first. Thanks again smiley
7  Using Arduino / Displays / Re: Serial LCD help - newbie at programming on: November 29, 2012, 03:12:17 pm
Alright. So where do I place an order to get the back pack with the firmware?
8  Using Arduino / Displays / Re: Serial LCD help - newbie at programming on: November 29, 2012, 07:02:46 am
OK, but how is the LCD connected since it only has 3 pins
9  Using Arduino / Displays / Re: Serial LCD help - newbie at programming on: November 28, 2012, 08:26:27 pm
Thank you smiley , and 5-6 buttons. Also, how does the backpack connect since the lcd only has a 3-pin connection (5v, gnd, rx)
10  Using Arduino / Displays / Re: Serial LCD help - newbie at programming on: November 28, 2012, 05:53:21 pm
So do I need to order the 4x4 keypad also? or can I use my buttons that I have
11  Using Arduino / Displays / Re: Serial LCD help - newbie at programming on: November 28, 2012, 10:40:29 am
Alright I'll put in an order and try to figure out some code
12  Using Arduino / Displays / Re: Serial LCD help - newbie at programming on: November 28, 2012, 06:39:32 am
So where do I order?
13  Using Arduino / Displays / Re: Serial LCD help - newbie at programming on: November 27, 2012, 11:35:36 pm
So is there any assembly (like soldering) involved with a phi panel? Cause i don't know how to solder. And where do i buy one? if i cant use my lcd and some buttons smiley-razz
14  Using Arduino / Displays / Re: Serial LCD help - newbie at programming on: November 27, 2012, 04:49:52 pm
Alright. So we can assign all these features to buttons on the phi panel? Or could I use the serial LCD with some buttons for the same task?
15  Using Arduino / Displays / Re: Serial LCD help - newbie at programming on: November 27, 2012, 02:27:44 pm
5 times a second sounds good. And is the code above good for basic screen display with scrolling? Cause I was thinking about adding a button to disable/enable the robot and for turning backlight on/off
Pages: [1] 2 3