www.robowars.org

RoboWars Australia Forum Index -> State Specific Information

Robowars Nationals TODO List
Goto page 1, 2, 3  Next

Post new topic   Reply to topic
  Author    Thread
marto
Experienced Roboteer


Joined: 08 Jul 2004
Posts: 5459
Location: Brisbane, QLD


 Reply with quote  
Robowars Nationals TODO List

As with every year there is a bunch of stuff which we need to do surrounding the event. This list is for my benefit as well as anyone who can help out with the tasks.

TODO
- Test Arena Door
- Check Floor state
- Flyers for gallery
- Robot Trading Crads
- Highlights video
- MOU with gallery
- Run sheet finalised
- FB Event
- Green Ant Repairs
- Arena Lighting
- Arena Timer
- TV Video Streaming Test
- QRSC 2015/16 Budget


I am sure I will have more things to add to this. Feel free to mention them and thanks for everyone who is helping out with these.

Steve
_________________
Steven Martin
Twisted Constructions
http://www.botbitz.com

Post Mon Jul 27, 2015 11:25 am 
 View user's profile Send private message Send e-mail MSN Messenger
marto
Experienced Roboteer


Joined: 08 Jul 2004
Posts: 5459
Location: Brisbane, QLD


 Reply with quote  

So Reality check time

TODO
- Test Arena Door - "Was it really that bad" - TODO
- Check Floor state - Floor is ok probably needs a
- Flyers for gallery - Haven't asked probably not going to happen.
- Robot Trading Cards - Revision 1 done, revision 2 to come this weekend
- Highlights video - TODO - I have footage now.
- MOU with gallery - Done
- Run sheet finalised - TODO
- FB Event - Exists but no details
- Green Ant Repairs - This has been done but will need more work
- Arena Lighting - Thankyou nick
- Arena Timer - Thankyou nick
- TV Video Streaming Test - Not looking good
- QRSC 2015/16 Budget - Umm...
_________________
Steven Martin
Twisted Constructions
http://www.botbitz.com

Post Sat Aug 22, 2015 12:22 am 
 View user's profile Send private message Send e-mail MSN Messenger
Cpnwolfe



Joined: 29 May 2012
Posts: 449
Location: Rockhampton/qld


 Reply with quote  

I still have a vapour bot while I wait for steel to arrive, do you want a cad photo or a bot in peices photo? oh and I also have a 3d printed model
_________________
Trample the injured and hurdle the dead.

Post Sat Aug 22, 2015 10:07 am 
 View user's profile Send private message
Nick
Experienced Roboteer


Joined: 16 Jun 2004
Posts: 11799
Location: Sydney, NSW


 Reply with quote  

The arena lighting is ahead of schedule and I should be able to test the light output VS a standard fluro tube shortly ( I predict the tube will end up looking more like a glow-stick than a proper light).

The Display coding is struggling a bit; getting a state machine and even semi-accurate time is a challenge with my basic programming experience.
_________________
Australian 2015 Featherweight champion
UK 2016 Gladiator champion

Post Sat Aug 22, 2015 10:27 am 
 View user's profile Send private message
marto
Experienced Roboteer


Joined: 08 Jul 2004
Posts: 5459
Location: Brisbane, QLD


 Reply with quote  

Whatever looks the best. Really I need them all by first week of September. If it looks crappy they may choose not to print it.

As for coding I can try to help but its a bit hard debugging offsite. If you want to put it on a public repo might make it easier for us to help out/ post ideas.

Steve
_________________
Steven Martin
Twisted Constructions
http://www.botbitz.com

Post Sat Aug 22, 2015 10:57 am 
 View user's profile Send private message Send e-mail MSN Messenger
andrew



Joined: 16 Jun 2004
Posts: 3110
Location: Castle Hill, Sydney. N.S.W


 Reply with quote  

I can get you a cad pic soon but thats prob it until mid september from me

Sportsman i wont have anything yet as im still working out what to make.
_________________
Andrew Welch, Team Unconventional Robotics

Post Sat Aug 22, 2015 12:47 pm 
 View user's profile Send private message Send e-mail MSN Messenger
Spockie-Tech
Site Admin


Joined: 31 May 2004
Posts: 3160
Location: Melbourne, Australia


 Reply with quote  

quote:
Originally posted by Nick:

The Display coding is struggling a bit; getting a state machine and even semi-accurate time is a challenge with my basic programming experience.


Not sure if you're using a 'duino or not, but I recall you said you did alright translating Arduino code into whichever language you're using. So if you would like a copy of the proven Renta-a-Bots controller code I did for Sidetracked years back its available.

It implements about 4 independent timers (2 x play timers, 2 x weapon "cooldown" timers) with state machines and handles debounce, asynchronous events (buttons) and coin-inserts along with Relay and LCD output code, and cycling attract mode displays and so on.

It shouldnt be too hard (I havent looked at it in years, but I think it was fairly clearly written and commented) to extract the core functional timer routines and state-machine signalling functions, and adapt them to your requirements.

Worst case, if re-writing it to native code would exceed available time, you could just drop a $20 'duino in there and mod it to your needs.

Let me know if that would help you get rolling and Ill dig it out and send it to you (or post it if anyone else is interested in seeing a simple state machine implementation for robot timer use)
_________________
Great minds discuss ideas. Average minds discuss events. Small minds discuss people

Post Sun Aug 23, 2015 6:02 pm 
 View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Nick
Experienced Roboteer


Joined: 16 Jun 2004
Posts: 11799
Location: Sydney, NSW


 Reply with quote  

I am using an Embed board with an ARM M3 chip. It uses C++ and so far I haven't had any problems translating short pieces of demo code from Sparkfun to get their various bits of hardware going.

I solved the timing with a ticker so the RTC interrupts whatever my code is doing every second to decrement the time displays; seems to work well. I already have a number of routines to handle specific functions and the main problem is seeing the big picture and stringing them all together into a state machine. If you want to send me the code, that will probably help speed the project up considerably.
_________________
Australian 2015 Featherweight champion
UK 2016 Gladiator champion

Post Sun Aug 23, 2015 7:12 pm 
 View user's profile Send private message
Spockie-Tech
Site Admin


Joined: 31 May 2004
Posts: 3160
Location: Melbourne, Australia


 Reply with quote  

Here it is..

You will see the main loop is very simple, just runs around repeatedly calling the 6 main checks (states). The play-timer, weapon_timer etc values are used as state-mode-controls through using nested if's, rather than explicit declaration of modes, which is more common in multi-modem state-machines.

The code reads nicer if you set your tabs so that the //'s line up nicely, and if you are using an editor that supports code-folding (Very useful for hiding clutter), the //{ and //} comment marks define code-folding points to roll-up blocks of subroutines, like the I2C Port Expander I/O (used to make 16x2 LCD comms only take up 2 pins)

Fold (or delete) the LCD I/O functions, Take out all the declares, and definitions, attract messages and comments, and you can see the core execution is really just the 6 state-checks running off the millis() timer at the end.

As Jake said, Many State-Machines are really just a heap of nested if-then statements (or use case-switch to the same effect). Normally you would use a few semaphore/flags for linked-functions to signal each other about what theyre up to, but this didnt need that.

Note the version number is 0.11 though. it all worked perfectly *first time at alpha version 0.1, and the +0.01 was just to adjust the play timers a bit, so it most follow some clean-ish logic Smile

I hope it helps. sometimes other peoples code can help light a bulb, other times you read it and go "Why the hell would anyone do it *that way !?!" Smile

code:

//  TechnoMagic SideTracked RentaBot Controller v0.11
//  update 0.11 - change weapon timer to 4 on 3 off
//                     - change credit time to 90 seconds per coin (down from 180)
/*  ------------------------------------------------
By Brett Paulin
May 2009
Version 0.1

This is a library of routines to drive a HD44780 LCD Connected via I2C MCP23017 as per the the I2C-SPI LCD
"back-pack" from SpikenzieLabs.com .
 
 HOOK-UP:
  SIGNAL     I2C LCD BOARD    -    ARDUINO
  Ground          GND                 GND
   VCC            5V                  5V
   SDA**          SDA               Analog 4
   SCL**          SCL               Analog 5

   The buttons (if used) are wired with a normally open (NO) switch to ground. (Pressing the button will contact the
   ground signal) J3 on the PCB has an extra ground and pins for buttons 1 to 5.

 ** I2C communications require a pull-up resistor on both the SCL and SDA lines. There must be a 4.7k through
    10kohm resistor on both the SDA and SCL pulling them up to VCC. Even if you are using other I2C devices
    use only one set of pull-up resistors.
    Pull-up resistors are not included on the I2C-SPI LCD board, for the following reasons; they are not
    required when the board is used with the SPI interface, only one set of resisters is required for the I2C
    bus (if you where to use more them one board there would be too many), and it gives you more control.

 USAGE:
 1. Disconnect the power and hook-up the Arduino and the I2C Board as described above.
 2. Set your I2C address. (Up to 7 I2C Boards and be used on the same I2C bus.)
    See below in the define section for this line
                     #define      MCP23017   B00100xxx
                                                       the "xxx" is your board's changeable I2C Address
    Use the dip switch on the I2C board to modify the address. Switch position 1 is the LSB, rightmost "x" above.
 3. Power the board and upload the sketch.
 4. You should see a message and a counter on your LCD. If you hooked up buttons and are pressing one, you should
    also see that message. You may need to adjust the contrast POT (blue square on PCB) to see the display properly.                               

 LEGAL:
 This code is provided as is. No guaranties or warranties are given in any form. It is up to you to determine
 this codes suitability for your application.
*/

//{ Value, Control and I/O Definitions
//{ Port Expander
#define      MCP23017   B00100000   // MCP23017 I2C Address was B01000000 - last 3 are address bits
#define      IOCON         0x0A      // MCP23017 Config Reg.
#define      IODIRA      0x00      // MCP23017 address of I/O direction
#define      IODIRB      0x01      // MCP23017 1=input
#define      IPOLA         0x02      // MCP23017 address of I/O Polarity
#define      IPOLB         0x03      // MCP23017 1= Inverted
#define      GPIOA         0x12      // MCP23017 address of GP Value
#define      GPIOB         0x13      // MCP23017 address of GP Value
#define      GPINTENA   0x04      // MCP23017 IOC Enable
#define      GPINTENB   0x05      // MCP23017 IOC Enable
#define      INTCONA      0x08      // MCP23017 Interrupt Cont
#define      INTCONB      0x09      // MCP23017 1= compair to DEFVAL(A or B) 0= change
#define      DEFVALA      0x06      // MCP23017 IOC Default value
#define      DEFVALB      0x07      // MCP23017 if INTCONA set then INT. if diff.
#define      GPPUA         0x0C      // MCP23017 Weak Pull-Ups
#define      GPPUB         0x0D      // MCP23017 1= Pulled HIgh via internal 100k
//}
//{ LCD Control
#define      LCDClr      0x01      // clear the LCD
#define      LCDHome      0x02      // move cursor to home position
#define      LCDCsLf      0x10      // move cursor left
#define      LCDCSRt      0x14      // move cursor right
#define      LCDShftL   0x18      // shift displayed chars left
#define      LCDShftR   0x1C      // shift displayed chars right
#define      LCDDDRam   0x80      // Display Data RAM control (Address in Lower 7 bits)
#define      LCDddram2   0xC0      // 9th position of display ??

#define      RS_pin      B00000100
#define      RW_pin      B00000010
#define      E_pin         B00000001
//}
//{ IO Pins
#define      weapon1_ready      8   //   Weapon 1 Ready Indicator Light
#define      weapon2_ready      9   //   Weapon 1 Ready Indicator Light

#define    credit1_inPin    7 // Input - credit slot 1
#define    credit2_inPin    6 // Input - credit slot 2
#define      weapon1_inPin      8   // Input - Bot Weapon Trigger 1
#define      weapon2_inPin      9   // Input - Bot Weapon Trigger 2

#define      weapon1_outPin   5   // Output - Bot Weapon Enable 1
#define      weapon2_outPin   4   // Output - Bot Weapon Enable 2
#define      bot1_en_outPin   3   // Output - Bot 1 Enable
#define      bot2_en_outPin   2   // Output - Bot 2 Enable


//}

#define      attract_msg_change_delay 2500  // 2500 = 2.5 seconds        // display change speed
#define      credit_time   90000                   //90,000 = 90 seconds - 180,000 milliseconds = 180 seconds = 3 minutes

//}

//{ Variable Initialisation
byte LCDCONT       = 0;        // REQUIRED
byte button          = 0;        // REQUIRED
int  i                 = 0;        // REQUIRED
int  j                   = 0;
int    buttonPress   = 0;
int    count           = 0;
char print_buffer[16];
char attract_msg [17]="                ";
char NUMB[4] =  "000";

unsigned long play_timer_1       = 0;   //   Player 1 millis play end time
unsigned long countdown_pt_1   = 0;   //                  remaining countdown time
unsigned long play_timer_2       = 0;   //   Player 2 millis end time
unsigned long countdown_pt_2   = 0;   //                  remaining countdown time

unsigned long weapon_timer_1    = 0;   //   Player 1 millis weapon timer
unsigned long countdown_wt_1    = 0;   //                weapon countdown timer
int                  weapon_1_active = 0;   //                 Weapon 1 Active
int                  weapon_1_ready   = 0;   //                Weapon 1 Ready to Fire
unsigned long weapon_timer_2    = 0;   //   Player 2 millis weapon timer
unsigned long countdown_wt_2   = 0;   //                weapon countdown timer
int                  weapon_2_active = 0;   //                 Weapon 2 Active
int                  weapon_2_ready   = 0;   //                Weapon 2 Ready to Fire

unsigned long attract_msg_change_time ; // Attract message change timer
int                  attract_msg_num =0;      //   Counter for which attract message showing

unsigned long   weapon_cycle_time  = 2000;         //  4 second cycle time (millis)
unsigned long weapon_active_time = 0700;      //  2 second active, 2 second recharge time

int   credit1_change;                           // Coin Input 1 change detect
int credit2_change;                           // Coin Input 1 change detect
int   weapon1_change;                           // Weapon Fire 1 Input Change Detect
int   weapon2_change;                           // Weapon Fire 1 Input Change Detect

// ** Attract Messages **
char* attract_msg_array[]={
// 34567890123456"    < -16chr Sizer

"* Robot Wars ! *",
"RC Fighting Bots",

" 2 CREDITS EACH ",
" FOR 3 MINUTES  ",

" Remote Control ",
"Fighting Robots!",

"Insert 2 credits",
"to begin Battle ",

"Insert 1 credit ",
"for extra 90 sec",

"Smash the Robots",
"into submission!",

"Unlimited Battle",
"add credit +time",

"Two Robots Enter",
"One Robot Leaves",

"Insert 2 credits",
"to begin Battle ",

"Insert 1 credit ",
"for extra 90 sec",

};

int  attract_msg_count=19;

//}

//{ Add-In Library Functions
#include <Wire.h>      // Used for the I2C Communications
#include <PString.h>    // Used to render Values to Strings for Printing
#include <Debounce.h>   // Used to detect switch inputs with debounce time
//}
 
//------------------------------------------------------
//{ Setup

   Debounce credit1_in = Debounce(20, credit1_inPin);
   Debounce credit2_in = Debounce(20, credit2_inPin);
   Debounce weapon1_in = Debounce(20, weapon1_inPin);
   Debounce weapon2_in = Debounce(20, weapon2_inPin);
      
void setup()     
{
  Wire.begin();                                                        // join i2c bus (address optional for master)
  portexpanderinit();
  LCDinit();
  LCDcmd(LCDClr);
 
  pinMode(credit1_inPin, INPUT);         //    Set Credit1 Input Pin to be an input
  pinMode(credit2_inPin, INPUT);         //    Set Credit2 Input Pin to be an input
   pinMode(weapon1_inPin, INPUT);         //    Set weapon1 Input Pin to be an input
   pinMode(weapon2_inPin, INPUT);         //    Set weapon2 Input Pin to be an input

   pinMode(weapon_1_ready, OUTPUT);         //    Set weapon1 Ready Pin to be an output
   pinMode(weapon_2_ready, OUTPUT);         //    Set weapon2 Ready Pin to be an output
   pinMode(weapon1_outPin, OUTPUT);         //    Set weapon1 Output Enable Pin to be an output
   pinMode(weapon2_outPin, OUTPUT);         //    Set weapon2 Output Enable Pin to be an output
   pinMode(bot1_en_outPin, OUTPUT);         //    Set weapon2 Output Enable Pin to be an output
   pinMode(bot2_en_outPin, OUTPUT);         //    Set weapon2 Output Enable Pin to be an output

// *********************************************
Serial.begin(9600);   // ** Debugging output on
// *********************************************


}  // end of setup loop
//}

//------------------------------------------------------
//{ Main Loop
void loop()         
{
   
attract_mode_display(); // Call Attract Mode to display messages if neither Bot active

coin_1_check();          // coin check and inc play timers if sensed
coin_2_check();          
                                 // Add to cumulative run timer for each bot ??

bot_1_active_check();   // see if bot is active and enable if req
bot_2_active_check();

bot_1_weapon_check();   // timer control and inhibit of bot weapons         
bot_2_weapon_check();

}  // End of Main Loop
//}


//------------------------------------------------------
//{   Functions and Subroutines

//{ I2C Bus Control Functions
void I2C_TX(byte device, byte regadd, byte tx_data)  // Transmit I2C Data
{
  Wire.beginTransmission(device);
  Wire.send(regadd);
  Wire.send(tx_data);
  Wire.endTransmission();
}

void I2C_RX(byte devicerx, byte regaddrx)       // Receive I2C Data
{
  Wire.beginTransmission(devicerx);
  Wire.send(regaddrx);
  Wire.endTransmission();
  Wire.requestFrom(int(devicerx), 1);   

  byte c = 0;
  if(Wire.available())
  {
    byte c = Wire.receive();             
    button = c >>3;
  }
}

void portexpanderinit()                                    // Setup PortIO Chip
{
  // --- Set I/O Direction
  I2C_TX(MCP23017,IODIRB,B11111000);
  I2C_TX(MCP23017,IODIRA,B00000000);
  //  --- Set I/O Polarity
  I2C_TX(MCP23017,IPOLA,B00000000);
  I2C_TX(MCP23017,IPOLB,B11111000);
  //  --- Set ALL Bits of GPIOA
  I2C_TX(MCP23017,GPIOA,B00000000);
  // --- Set Weak Pull-Up on Bits 7 of GPIOB
  I2C_TX(MCP23017,GPPUB,B11111000);
  // --- Set Default on Bits 7 of GPIOB
  I2C_TX(MCP23017,DEFVALB,B00000000);
  // --- Set Use Default on Bits 7 of GPIOB
  I2C_TX(MCP23017,INTCONB,B10000000);
  // --- Set IOC on Bits 7 of GPIOB
  I2C_TX(MCP23017,GPINTENB,B10011000);
  // --- Set active low of int pin
  I2C_TX(MCP23017,IOCON,B00110000);
}

void checkbutton()             //   Red if Buttons are being Pressed
{
// Use serial monitor at 9600bps to see buttons that are pressed
  I2C_RX(MCP23017,GPIOB);
  buttonPress = int(button);
  switch (buttonPress)                       
  {
  case 1:
    Serial.println("Button-One");
    break;
  case 2:
    Serial.println("Button-Two");
    break;
  case 4:
    Serial.println("Button-Three");
    break;
  case 8:
    Serial.println("Button-Four");
    break;
  case 16:
    Serial.println("Button-Five");
    break;
  }
}

//}

//{ LCD Display Control Functions
void LCDinit()                                                // Initialise LCD
{
  // Only used with port expander
  LCDCONT = RS_pin | E_pin;
  I2C_TX(MCP23017,GPIOB,LCDCONT);
                                   // Standard Hitachi initialization for 8-bit mode form spec sheets
                                   // Instruction Timings Tweaked by Brett.
  delay(20);                  // 15ms Power Up Delay
  LCDcmd(B00110000);    // Set 8 bit Interface #1
  delay(5);                     // 5ms command delay
  LCDcmd(B00110000);    // Set 8 bit Interface #2
  delay(1);                     // 1ms (>100us) Delay
  LCDcmd(B00110000);    // Set 8 bit Interface #3
  delay(1);                     // 1ms (>37us) Delay
  LCDcmd(B00111000);    // Function Set - 8bit, 2lines, 5x8Font 
  delay(1);                     // 1ms (>37us) Delay
  LCDcmd(B00001000);    // Display Off, Cursor Off, Blink Off   
  delay(1);                     // 1ms (>37us) Delay
  LCDcmd(LCDClr);       // Clear Display
  delay(20);                  // 20ms (Time Unspec?)
  LCDcmd(B00000110);       // Entry mode = Increment, Move Cursor (not shift display)
  delay(1);                     // 1ms (>37us) Delay
  LCDcmd(B0001100);     // Display On, Cursor Off, Blink Off
  delay(1);                     // 1ms (>37us) Delay
}

void LCDsetadd (byte LCDadd)                           // Set Cursor Address
{
   LCDcmd (LCDadd | LCDDDRam);                           // OR Mix Set Ram cmd with Address and send
}

void LCDcmd(byte cmdlcd)                                 // Send Command to LCD
{
  LCDCONT =0;                                     // Register Select = Command
  I2C_TX(MCP23017,GPIOB,LCDCONT);
  LCDwr(cmdlcd);
//  delay(02);
}

void LCDwr(byte lcdChar)                                 // Send Data to LCD
{
  I2C_TX(MCP23017,GPIOA,lcdChar);
  LCDCONT = LCDCONT | E_pin;              // If RS is set then it stays set
  I2C_TX(MCP23017,GPIOB,LCDCONT);
  LCDCONT = RS_pin;
  I2C_TX(MCP23017,GPIOB,LCDCONT);
}

void dispnumb(int numbvar)                              //   Send Decimal Number to Display
{
 // int THUS= abs(numbvar/1000);
//  int HUNDS= abs(numbvar/100);
//  int TENS = abs((numbvar - (HUNDS*100))/10);
//  int ONES = abs(numbvar-(HUNDS*100)-(TENS*10));
  int TENS = abs((numbvar)/10);
  int ONES = abs(numbvar-(TENS*10));

//  NUMB[0] =  HUNDS+48;                                                        // +48 for ASCII conversion
  NUMB[1] =  TENS+48;
  NUMB[2] =  ONES+48;

  for(i=1;i<3;i++)
  {
    LCDwr(NUMB[i]);                                                           // Print-Out 3 digit number at cursor
  }
}

void LCDmessage (char message[])                    // Send String Message to Display @ current cursor pos
{
   int j;
   do
   {
  LCDwr(message[j]);
  j = ++j;
   } while (message[j] != 0);
}

//}

//{ Bot Control Functions
   
void attract_mode_display()
{
   if ( ( (play_timer_1 <= millis() ) && (play_timer_2 <= millis() ) ) )      // check to ensure both bots off
      {
      if ( attract_msg_change_time < millis() )                                             // is it time to change the message ?
         {   
            LCDsetadd (0);                                                                              // if so, set the cursor home
//            attract_msg = attract_msg_array[attract_msg_num];                           // select the next message from the group
            LCDmessage(attract_msg_array[attract_msg_num]);                                                               // and display it
            attract_msg_num++ ;                                                                        // now the 2nd line
            LCDsetadd (64);
//            attract_msg = attract_msg_array[attract_msg_num];
            LCDmessage(attract_msg_array[attract_msg_num]);                                                               // and display it
            attract_msg_num++ ;                                                                        // pointer to next msg for next cycle

            if (attract_msg_num > attract_msg_count)                                          // check for overflow and reset
               attract_msg_num = 0;
                                                                                             
            attract_msg_change_time = millis() + attract_msg_change_delay;         // set how long to delay before changing msg
               
         }
      }
}

void coin_1_check()
{   
   credit1_change = credit1_in.update();
   if (credit1_in.read() && credit1_change)      
      {
         // check to see if timer is running or not and start it if not, else add credit time to current
         if (play_timer_1 < millis())
            {
            play_timer_1 = millis() + credit_time;
            }
            else
            {
            play_timer_1 = play_timer_1 + credit_time;
            }
      }
}

void coin_2_check ()
{
   credit2_change = credit2_in.update();
   if (credit2_in.read() && credit2_change)      
      {
         // check to see if timer is running or not and start it if not, else add credit time to current
         if (play_timer_2 < millis() )
            {
            play_timer_2 = millis() + credit_time;
            }
            else
            {
            play_timer_2 = play_timer_2 + credit_time;
            }
      }
}

void bot_1_active_check()
{   
   if ( play_timer_1 > millis() )
   {   
      digitalWrite (bot1_en_outPin, HIGH);                        // enable bot 1 relay output
      countdown_pt_1 = ((play_timer_1 - millis())/1000);   // convert millis to secs for display
   
   if (!(weapon_1_active && (countdown_wt_1 <= (weapon_active_time/1000) ) ) )  // only diplay power if weapon_recharge is not being displayed   
   {
      // set display address and send message
      LCDsetadd (0);
      LCDmessage ("Robot1 Power ");
      LCDsetadd (12);      

//{  Display Formating according to counter size
      if (countdown_pt_1 < 10000)            // only add this code if >9999 Seconds required.
//      { LCDmessage(" "); }                  // causes last chr of Power message to flicker
      if (countdown_pt_1 < 1000 )
         { LCDmessage(" "); }
      if (countdown_pt_1 < 100 )
         { LCDmessage(" "); }
      if (countdown_pt_1 < 10 )
         { LCDmessage(" "); }
//}      
      PString (print_buffer, 6, countdown_pt_1);
      LCDmessage (print_buffer);
   }
   
   if (play_timer_2 < millis() )
         {
         LCDsetadd (64);
         LCDmessage ("Bot2 Add Coins !");   // display other player attract - insert coin to join in - message}
         }         
   }
   else
      {   digitalWrite (bot1_en_outPin, LOW); }   // ## Disable Bot 1 output   
}   

void bot_2_active_check()
{
   
   if ( play_timer_2 > millis() )
   {   
      digitalWrite (bot2_en_outPin, HIGH);                        // enable bot 1 relay output
      countdown_pt_2 = ((play_timer_2 - millis())/1000);   // convert millis to secs for display

   if (!(weapon_2_active && (countdown_wt_2 <= (weapon_active_time/1000) ) ) )  // only diplay power if weapon_recharge is not being displayed   
   {

// set display address and send message
      LCDsetadd (64+0);
      LCDmessage ("Robot2 Power ");
      LCDsetadd (64+12);
      
//{  Display Formating according to counter size
      if (countdown_pt_2 < 10000)            // only add this code if >9999 Seconds required.
//      { LCDmessage(" "); }                  // causes last chr of Power message to flicker
      if (countdown_pt_2 < 1000 )
         { LCDmessage(" "); }
      if (countdown_pt_2 < 100 )
         { LCDmessage(" "); }
      if (countdown_pt_2 < 10 )
         { LCDmessage(" "); }
//}            
   PString (print_buffer, 6, countdown_pt_2);
   LCDmessage (print_buffer);
  }

   if (play_timer_1 < millis() )
         {
         LCDsetadd (0);
         LCDmessage ("Bot1 Add Coins !");   // display other player attract - insert coin to join in - message}
         }
   }
   else
      {   digitalWrite (bot2_en_outPin, LOW); }   // ## Disable Bot 2 output   
}

void bot_1_weapon_check()
{
 if (millis() < weapon_timer_1)
       {countdown_wt_1 = ( ( weapon_timer_1 - millis() ) /1000 );    // calculate current weapon timer
        weapon_1_active = true;
       }      
   else
      {weapon_1_active = false;}
         
   if (weapon_1_active)
      {
       if (countdown_wt_1 > (weapon_active_time/1000))
         { digitalWrite (weapon1_outPin,HIGH);   }                     // activate the weapon relay if time not expired
       else
          {
           digitalWrite (weapon1_outPin,LOW);                           //   LED drive from relay led ?
              
         LCDsetadd (0);                                                       // ** This block of code might be disabled if display conflict not desireable
         LCDmessage ("WeaponRecharge");
         if (countdown_wt_1 < 10 )                                             
             { LCDmessage(" "); }                                       // Insert a space if <10seconds left to pad position
          PString (print_buffer, 2, countdown_wt_1);            // turn weapon timer value into string
         LCDmessage (print_buffer);                                    // and send it         
         }                                                                  
       }   
    
     else                                                                        // only do this if weapon not active
        if ( play_timer_1 > millis() )                              // AND bot is active - no weapons after play expired
         {
           weapon1_change = weapon1_in.update();                        // then check to see if weapon button pushed
           if (weapon1_in.read() && weapon1_change)                     // if debounced button is pushed
            {weapon_timer_1 = millis() + weapon_cycle_time;}     // then start the weapon timer
          }
}      

void bot_2_weapon_check()
{
if (millis() < weapon_timer_2)
       {countdown_wt_2 = ( ( weapon_timer_2 - millis() ) /1000 );    // calculate current weapon timer
        weapon_2_active = true;
       }      
   else
      {weapon_2_active = false;}
         
   if (weapon_2_active)
      {
       if (countdown_wt_2 > (weapon_active_time/1000))
         { digitalWrite (weapon2_outPin,HIGH);   }                     // activate the weapon relay if time not expired
       else
          {
           digitalWrite (weapon2_outPin,LOW);                           //   LED drive from relay led ?
              
         LCDsetadd (64);                                                       // ** This block of code might be disabled if display conflict not desireable
         LCDmessage ("WeaponRecharge");
         if (countdown_wt_2 < 10 )                                             
             { LCDmessage(" "); }                                       // Insert a space if <10seconds left to pad position
          PString (print_buffer, 2, countdown_wt_2);            // turn weapon timer value into string
         LCDmessage (print_buffer);                                    // and send it         
         }                                                                  
       }   
    
     else                                                                        // only do this if weapon not active
        if ( play_timer_2 > millis() )                              // AND bot is active - no weapons after play expired
         {
           weapon2_change = weapon2_in.update();                        // then check to see if weapon button pushed
           if (weapon2_in.read() && weapon2_change)                     // if debounced button is pushed
            {weapon_timer_2 = millis() + weapon_cycle_time;}     // then start the weapon timer
          }
}
//}

//}



_________________
Great minds discuss ideas. Average minds discuss events. Small minds discuss people

Post Sun Aug 23, 2015 11:33 pm 
 View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Nick
Experienced Roboteer


Joined: 16 Jun 2004
Posts: 11799
Location: Sydney, NSW


 Reply with quote  

Thanks Brett, that is hugely useful!
_________________
Australian 2015 Featherweight champion
UK 2016 Gladiator champion

Post Mon Aug 24, 2015 6:39 am 
 View user's profile Send private message
Valen
Experienced Roboteer


Joined: 07 Jul 2004
Posts: 4433
Location: Sydney


 Reply with quote  

dang, that is clean. Respect
_________________
Mechanical engineers build weapons, civil engineers build targets

Post Mon Aug 24, 2015 9:15 am 
 View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Spockie-Tech
Site Admin


Joined: 31 May 2004
Posts: 3160
Location: Melbourne, Australia


 Reply with quote  

Thanks Jake Smile

I was quite pleased with it when I wrote it. Id been doing some Python coding for another job, and the enforced whitespace rules of python encouraged me to take the trouble to make it look nice, especially since it was for a customer and not just code for one of my projects. Its a lot simpler to follow the function flows if you get rid of all the LCD/PortExpIO/and display Formatting fudge code too.

A pity the tab lengths (I think 8 is the right value) make it look a bit messier here.
_________________
Great minds discuss ideas. Average minds discuss events. Small minds discuss people

Post Mon Aug 24, 2015 10:56 am 
 View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
marto
Experienced Roboteer


Joined: 08 Jul 2004
Posts: 5459
Location: Brisbane, QLD


 Reply with quote  

TODO
- Test Arena Door - "Was it really that bad" - Yes it was and it needs to be fixed
- Check Floor state - Miles has volunteered
- Robot Trading Cards - Revision 1 done, revision 2 to come this weekend
- Highlights video - Nope....
- Run sheet finalised - TODO
- FB Event - Exists but no details
- Green Ant Repairs - Ants are up and running but need new batteries.
- Arena Lighting - Thankyou nick?
- Arena Timer - Thankyou nick?
- TV Video Streaming Test - Not looking good
- Shirts - TODO

Plan for next few days:

- Do as many cards as possible from Builders DB so far nobody has assisted with supplying details.
- Reload trailer with arena.
- Ditch old top layer floor.
- Re Paint bottom outside layer of floor.
- Drill the steel bottom barriers.
- Sort the Arena Bolts
- Finalise Shirt order
- Replace all the green ants batteries and pack.

I tested RobowarsAustralia's youtube streaming today and it seems to work, we could probably run this if we really wanted, however without proper setup and production I don't think its really a good idea.

I also tried streaming over wifi to a ChromeCast I grabbed. That didn't work very well at all. It would let us do a screen display for like upcoming fights but its not responsive enough for streaming video without an integrated App to buffer footage.
_________________
Steven Martin
Twisted Constructions
http://www.botbitz.com

Post Thu Sep 24, 2015 9:32 pm 
 View user's profile Send private message Send e-mail MSN Messenger
marto
Experienced Roboteer


Joined: 08 Jul 2004
Posts: 5459
Location: Brisbane, QLD


 Reply with quote  

So the arena has been loaded back into the trailer.

I have the door out and its looking pretty sad. I haven't worked out how the hell to fix the pins really needs something stronger. Will think on it the next few days.

The beams are there ready to drill. Ants have been unpacked and should just need a battery swap and be ready to go again.

Steve
_________________
Steven Martin
Twisted Constructions
http://www.botbitz.com

Post Sun Sep 27, 2015 9:26 pm 
 View user's profile Send private message Send e-mail MSN Messenger
Nick
Experienced Roboteer


Joined: 16 Jun 2004
Posts: 11799
Location: Sydney, NSW


 Reply with quote  

By pins, do you mean the door locks? I have a design in mind that will fix the alignment issues and is fairly easy to make - will make an MDF demo tomorrow to test it out.
_________________
Australian 2015 Featherweight champion
UK 2016 Gladiator champion

Post Sun Sep 27, 2015 10:12 pm 
 View user's profile Send private message
  Display posts from previous:      

Forum Jump:
Jump to:  

Post new topic   Reply to topic
Page 1 of 3

Goto page 1, 2, 3  Next

Forum Rules:
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 vote in polls in this forum

 

Last Thread | Next Thread  >
Powered by phpBB: © 2001 phpBB Group
millenniumFalcon Template By Vereor.