www.robowars.org

RoboWars Australia Forum Index -> Technical Chat

Antweight Resource Page
Goto page Previous  1, 2, 3, 4 ... 10, 11, 12  Next

Post new topic   Reply to topic
  Author    Thread
marto
Experienced Roboteer


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


 Reply with quote  

Think this mixing should work though not tested.

Steve

code:

#include <OrangutanMotors.h>

#define CH1 7
#define CH2 4

#define rcMin 1200
#define rcMax 1900
#define DEBUG 0
#define EXPO  0
#define MIXING 0

OrangutanMotors motors; 
unsigned long input2;
unsigned long input1;

void setup()
{
  if(DEBUG)
  {
    Serial.begin(38400);
    Serial.println("Start");
  }
  pinMode(CH1,INPUT);
  pinMode(CH2,INPUT);
}

void loop()
{
  input2 = pulseIn(CH2, HIGH) ;
  input1 = pulseIn(CH1, HIGH) ;
 
  if (input2 != 0 && input1 != 0)
  {
    if(DEBUG)
    {
      Serial.println("Input");
      Serial.println(input1);
      Serial.println(input2);
    }
   
   
    int M1 = (input1 - rcMin) -  (rcMax - rcMin)/2;
    int M2 = (input2 - rcMin) -  (rcMax - rcMin)/2;
   
    if(EXPO)
    {
      M1 = (M1/(rcMax - rcMin))^3 * (rcMax - rcMin);
      M2 = (M2/(rcMax - rcMin))^3 * (rcMax - rcMin);
    }
   
    if(MIXING)
    {
       long temp = M1 - M2;
       if (temp > 250)
       {
         temp = 255;
       }
       else if (temp < 250);
       {
         temp = -255;
       }
       
       long temp2 = M1 + M2;
       if (temp2 > 250)
       {
         temp2 = 255;
       }
       else if (temp2 < 250);
       {
         temp2 = -255;
       }
       
       M1 = temp;
       M2 = temp2;
    }   
     

    motors.setSpeeds(M1,M2);
  } 
}
 
 



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

Post Sun Jul 18, 2010 1:15 pm 
 View user's profile Send private message Send e-mail MSN Messenger
Philip
Experienced Roboteer


Joined: 18 Jun 2004
Posts: 3842
Location: Queensland near Brisbane


 Reply with quote  

Excellent news. Can it also sense when lipols get to 3v per cell?
_________________
So even the rain that falls isn't actually going to fill our dams and our river systems

Post Sun Jul 18, 2010 1:35 pm 
 View user's profile Send private message
marto
Experienced Roboteer


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


 Reply with quote  

Probably could, will look into it.

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

Post Sun Jul 18, 2010 2:33 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  

Also in code above there is a few little errors.

Extra ";" in else ifs and no "-ve" in less than statements.

Makes a big difference
_________________
Steven Martin
Twisted Constructions
http://www.botbitz.com

Post Sun Jul 18, 2010 10:00 pm 
 View user's profile Send private message Send e-mail MSN Messenger
Knightrous
Site Admin


Joined: 15 Jun 2004
Posts: 8511
Location: NSW


 Reply with quote  

Tested Stevo's code, mixing works a treat.
Just drove Kruger around the floor on the code and it was great. Just need failsafe code wacked into it now.
_________________
https://www.halfdonethings.com/

Post Sun Jul 18, 2010 10:11 pm 
 View user's profile Send private message
marto
Experienced Roboteer


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


 Reply with quote  

Everything but exponential mixing appears to work. Not exactly sure why, it should work may be because it is clipped to +/-255 too late to think about it now.

code:

#include <OrangutanMotors.h>

#define CH1 7
#define CH2 4

#define rcMin 1200
#define rcMax 1900
#define DEBUG 0
//#define EXPO  0
#define MIXING 1

OrangutanMotors motors; 
unsigned long input2;
unsigned long input1;
unsigned int count = 0;
void setup()
{
  if(DEBUG)
  {
    Serial.begin(38400);
    Serial.println("Start");
  }
  pinMode(CH1,INPUT);
  pinMode(CH2,INPUT);
}

void loop()
{
  input2 = pulseIn(CH2, HIGH) ;
  input1 = pulseIn(CH1, HIGH) ;
 
  if (input2 != 0 && input1 != 0)
  {
    count = 0;
    if(DEBUG)
    {
      Serial.println("Input");
      Serial.println(input1);
      Serial.println(input2);
    }
   
   
    long M1 = (input1 - rcMin) -  (rcMax - rcMin)/2;
    long M2 = (input2 - rcMin) -  (rcMax - rcMin)/2;
   
    if (M1 > 250)
    {
      M1 = 255;
    }
    else if (M1 < -250)
    {
      M1 = -255;
    }
   
    if (M2 > 250)
    {
      M2 = 255;
    }
    else if (M2 < -250)
    {
      M2 = -255;
    }
   
   /*
    if(EXPO)
    {
      M1 = (M1/(rcMax - rcMin))^3 * (rcMax - rcMin);
      M2 = (M2/(rcMax - rcMin))^3 * (rcMax - rcMin);
    }
    */
    if(MIXING)
    {
       long temp = M1 - M2;
       if (temp > 250)
       {
         temp = 255;
       }
       else if (temp < -250)
       {
         temp = -255;
       }
       
       long temp2 = M1 + M2;
       if (temp2 > 250)
       {
         temp2 = 255;
       }
       else if (temp2 < -250)
       {
         temp2 = -255;
       }
       
       M1 = temp;
       M2 = temp2;
    }   
     

    motors.setSpeeds(M1 ,M2);
  }
  else
  {
    if (count > 100)
    {
      motors.setSpeeds(0,0);
    }
    else
    {
      count++;
    }
  }
 
}



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

Post Wed Jul 21, 2010 10:49 pm 
 View user's profile Send private message Send e-mail MSN Messenger
Fish_in_a_Barrel



Joined: 30 Sep 2006
Posts: 673
Location: Perth, Western Australia


 Reply with quote  


quote:
...may be because it is clipped to +/-255...
/*
if(EXPO)
{
M1 = (M1/(rcMax - rcMin))^3 * (rcMax - rcMin);
M2 = (M2/(rcMax - rcMin))^3 * (rcMax - rcMin);
}
*/


if(EXPO)
{
M1 = (M1/255)^3 * 255;
M2 = (M2/255)^3 * 255;
}
*/

I think is closer to what you want Smile

tho a squared would probably do better;

if(EXPO)
{
M1 = (M1/255)^2 * 255 * M1/ABS(M1);
M2 = (M2/255)^2 * 255 * M2/ABS(M2);
}
*/

but not sure if you have access to absolute value function call.
_________________
They say that he crossed the fine line, from insanity to genius.

Post Thu Jul 22, 2010 4:57 pm 
 View user's profile Send private message MSN Messenger
marto
Experienced Roboteer


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


 Reply with quote  

Yeh that looks better..
_________________
Steven Martin
Twisted Constructions
http://www.botbitz.com

Post Thu Jul 22, 2010 9:19 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  

Few other tips.

The 8A brushless ESCs are crappy buy the Plush ones. I fried 2 and I think aaron fried one.

The tires on the pololu wheels come off very easily. Which usually jams the wheel so I would be looking for other options.
_________________
Steven Martin
Twisted Constructions
http://www.botbitz.com

Post Sun Aug 08, 2010 5:20 pm 
 View user's profile Send private message Send e-mail MSN Messenger
assassin



Joined: 27 Jun 2004
Posts: 1105
Location: SunshineCoast


 Reply with quote  

Cant just glue them?
_________________
Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world.
Albert Einstein.

Post Sun Aug 08, 2010 5:38 pm 
 View user's profile Send private message Send e-mail
marto
Experienced Roboteer


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


 Reply with quote  

They are a bitch to get on let alone glue on. I haven't personally tried but I was thinking of trying to lift them up and superglue them on. But when they are like $6 a pair I am wondering what other wheel options there is.
_________________
Steven Martin
Twisted Constructions
http://www.botbitz.com

Post Sun Aug 08, 2010 5:51 pm 
 View user's profile Send private message Send e-mail MSN Messenger
assassin



Joined: 27 Jun 2004
Posts: 1105
Location: SunshineCoast


 Reply with quote  

http://www.robotgear.com.au/Product.aspx/Details/319

Could these be used for ants weights with the pololu gear/motors?
_________________
Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world.
Albert Einstein.

Post Sun Aug 08, 2010 9:03 pm 
 View user's profile Send private message Send e-mail
marto
Experienced Roboteer


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


 Reply with quote  

Same driver board as is on the Baby Oragnutans we are using. That needs a microcontroller to drive it. Which is exactly what the B328 has all in one board.

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

Post Sun Aug 08, 2010 9:16 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  

**Double Post **
_________________
Steven Martin
Twisted Constructions
http://www.botbitz.com

Post Sun Aug 08, 2010 9:16 pm 
 View user's profile Send private message Send e-mail MSN Messenger
Glen
Experienced Roboteer


Joined: 16 Jun 2004
Posts: 9481
Location: Where you least expect


 Reply with quote  

sounds like you could probably get away with a solid wheel in the antweights, they spend more time in the air then on the ground seemingly Laughing

Post Sun Aug 08, 2010 10:08 pm 
 View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
  Display posts from previous:      

Forum Jump:
Jump to:  

Post new topic   Reply to topic
Page 3 of 12

Goto page Previous  1, 2, 3, 4 ... 10, 11, 12  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.