View unanswered posts | View active topics It is currently Thu Oct 23, 2014 12:32 pm






Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Segway Robot 
Author Message
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: Segway Robot
ok, then it's probably not even a car :)

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Thu Dec 05, 2013 3:36 am
Profile
Rookie

Joined: Wed Oct 09, 2013 3:55 pm
Posts: 19
Post Re: Segway Robot
WOW! People with your semantics, it's just a senior project that I want to do for fun. :)
Does it have to be two wheeled to be posted on RobotC? I'm a poor man without a job atm using a schools vex kit! Give me a break!


Fri Dec 06, 2013 5:15 pm
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: Segway Robot
my reply was just to Ernest3.14.
You called the topic "Segway robot" - that's a fixed term. But MHTS already wrote what it's actually about:
MHTS wrote:
123girr wrote:
It is going to have four wheels. I don't need to worry about balancing it.

Then it is not a Segway robot. It sounds like you are just using the accelerometer as a controller (i.e. tilt it forward and the robot goes forward ... etc).

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Fri Dec 06, 2013 5:54 pm
Profile
Rookie

Joined: Wed Oct 09, 2013 3:55 pm
Posts: 19
Post Re: Segway Robot
I GET IT!!! Regardless, it's my project, my discussion, my idea, and your semantics. Can I not call it what I want? :evil:
If you have something to say, let it be about the code.


Tue Dec 10, 2013 4:13 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Segway Robot
I am sorry you got upset about our replies. For me, I was just trying to learn something from the forums. Segway robot is one of the things I wanted to learn more about. So when I saw the title, I was excited to read about it. But the description of your project doesn't match what I have in mind. That's why I was inquiring about it. It is not meant to be any criticism.


Tue Dec 10, 2013 4:26 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 593
Post Re: Segway Robot
Let's get this back on track :)

Would you be able to post a picture of the robot (if possible)? This will help us to determine what type of code you will need to run, exactly. For a basic, four-wheeled drive example, you should be able to simply add the extra motors and map them to the correct Joystick Accelerometer values:

Code:
  while(1)
   {
      bmotorflippedmode[port1] = true
      bmotorflippedmode[port10] = true
               
      //Both my motors are upsidedown :D
      motor[port1] = vexRT[AccelY] + vexRT[AccelX]; //Assuming this is the front right motor
      motor[port10] = vexRT[AccelY] - vexRT[AccelX]; //Assuming this is the front left motor
     
     motor[port2] = vexRT[AccelY] + vexRT[AccelX]; //Assuming this is the rear right motor
      motor[port9] = vexRT[AccelY] - vexRT[AccelX]; //Assuming this is the rear left motor

   }


Now if you wanted to get a bit fancier you can; for example you could adjust the front/rear motor values depending on the encoder values each are returning, to give them a more 'even' speed value:

Code:
 
      //These can be moved outside of the infinite loop, as they only need to executed once in the program
      bmotorflippedmode[port1] = true
      bmotorflippedmode[port10] = true

while(1)
   {     
     //This assumes both the rear and front right wheels have encoders attached
     //If the two are traveling at the same speed
     if(SensorValue(frontRightEncoder) == SensorValue(rearRightEncoder))
     {
     //Assign the same motor value
      motor[port1] = vexRT[AccelY] + vexRT[AccelX]; //Assuming this is the front right motor
      motor[port2] = vexRT[AccelY] + vexRT[AccelX]; //Assuming this is the rear right motor
     }

   //If the front is moving faster than the rear
   else if(SensorValue(frontRightEncoder) > SensorValue(rearRightEncoder))
    {
      //Increase the rear motor's speed
      motor[port1] = vexRT[AccelY] + vexRT[AccelX]; //Assuming this is the front right motor
      motor[port2] = vexRT[AccelY] + vexRT[AccelX] + 5; //Assuming this is the rear right motor
    }

   //If the front is moving slower than the rear
   else if (SensorValue(frontRightEncoder) < SensorValue(rearRightEncoder))
   {
      //Decrease the rear motor's speed
      motor[port1] = vexRT[AccelY] + vexRT[AccelX]; //Assuming this is the front right motor
      motor[port2] = vexRT[AccelY] + vexRT[AccelX] - 5; //Assuming this is the rear right motor
   }

   //Repeat process for left motors

}


Now this code isn't perfect by any means (it is also assuming one encoder on each wheel), but it is a good start for gaining 'finer tuned' control of the robot. You can really expand on the robot depending on what sensors you have available, what you would like for it to do, etc; the more information you are able to provide on your particular robot, the better we will be able to assist you (for instance, a listing of what sensors/motors are plugged into what ports, what you have available to use, etc).

Edit: Side note for explanation: the accelerometer values used here are from the VEXNet Joystick Controller itself, not from a sensor plugged into the Cortex. There is a 3-axis accelerometer built into the VEXNet Joystick Controller which can be used in lieu of (or tandem with) the physical joysticks to control a robot: http://www.robotc.net/wiki/VEX2_Functio ... net#AccelX

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Tue Dec 10, 2013 4:50 pm
Profile
Rookie

Joined: Wed Oct 09, 2013 3:55 pm
Posts: 19
Post Re: Segway Robot
MHTS wrote:
I am sorry you got upset about our replies. For me, I was just trying to learn something from the forums. Segway robot is one of the things I wanted to learn more about. So when I saw the title, I was excited to read about it. But the description of your project doesn't match what I have in mind. That's why I was inquiring about it. It is not meant to be any criticism.

If this is the case, then why do you say things like "Its not a segway" and "I would be supprised if this code works"?


Tue Jan 07, 2014 5:19 pm
Profile
Rookie

Joined: Wed Oct 09, 2013 3:55 pm
Posts: 19
Post Re: Segway Robot
To John
I took the robot apart in frustration and absorption in another project, but the final robot is going to look something like this:
--|--
|
|
|
|
||-----||
This is a piece of crap for presentations, but it will work (maybe).
For my purposes, the code I posted at first will work fine.
My Robotics teacher wants his supplies to survive as long as possible, and he won't let us stand on it because he is scarred it will burn out the motors (I highly doubt it though). I will just need to make a little joystick for being off my bot, then I could control it while I'm off of it. I won't need any gyros because, like I said, its 4 wheeled. Also, for your program, it is a two motored robot, and I plan to keep it that way. Neither have encoders on them, and I was hoping that I could just make it go at a custom speed based on the position of the robot. As for "fine tuning" it, I don't think I need to do that.


Tue Jan 07, 2014 5:34 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 23 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users and 2 guests


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.