ROBOTC.net forums
http://www.robotc.net/forums/

Segway Robot
http://www.robotc.net/forums/viewtopic.php?f=15&t=6919
Page 1 of 2

Author:  123girr [ Wed Oct 09, 2013 4:12 pm ]
Post subject:  Segway Robot

Lolz, this is going to be a fun project, not to mention I need to have it done to graduate. :lol: My robotics teacher has been making jokes about a segway for two years now.
I am using a two motor robot with the vex built in accelerometors. This is the code I have so far.
Code:
task main()
{
   while(1)
   {
      bmotorflippedmode[port1] = true
      bmotorflippedmode[port10] = true
               
      //Both my motors are upsidedown :D
      motor[port1] = vexRT[AccelY] + vexRT[AccelX];
      motor[port10] = vexRT[AccelY] - vexRT[AccelX];
   }
}

Much simpler than I was thinking. Thank You RobotC!

Author:  123girr [ Wed Oct 09, 2013 4:14 pm ]
Post subject:  Re: Segway Robot

Sorry, my html skillz aren't very good, so you are just going to have to deal with not knowing the indents. (Hint: I put a bracket whenever I indent.[{}])

Author:  mattallen37 [ Wed Oct 09, 2013 5:35 pm ]
Post subject:  Re: Segway Robot

BTW, these forums don't use HTML for formatting. They use BBCode.

Try using the code tags:
Code:
[code][/code]

Author:  123girr [ Sun Oct 27, 2013 5:03 pm ]
Post subject:  Re: Segway Robot

Oh, thanks for the tip. :)

Author:  123girr [ Tue Oct 29, 2013 4:01 pm ]
Post subject:  Re: Segway Robot

Working on building a more sturdy robot that can actually hold a person on it. It's going to have 3 wagon wheels, (my mentor felt it would be easier/cheaper to use 3 and have it be sturdy rather than 2 and have people falling over) 2 bigger motors from the first robotics team at my school, and just a vex cortex with the controller for the accelerometers. I am open to any ideas that some person might have. I'll record how it works and post it on youtube.

Author:  MHTS [ Tue Oct 29, 2013 8:44 pm ]
Post subject:  Re: Segway Robot

123girr wrote:
Lolz, this is going to be a fun project, not to mention I need to have it done to graduate. :lol: My robotics teacher has been making jokes about a segway for two years now.
I am using a two motor robot with the vex built in accelerometors. This is the code I have so far.
Code:
task main()
{
   while(1)
   {
      bmotorflippedmode[port1] = true
      bmotorflippedmode[port10] = true
               
      //Both my motors are upsidedown :D
      motor[port1] = vexRT[AccelY] + vexRT[AccelX];
      motor[port10] = vexRT[AccelY] - vexRT[AccelX];
   }
}

Much simpler than I was thinking. Thank You RobotC!

I would be really surprised if this code works. Would you tell us how you mounted the accelerometer? Which axis is up/down, which one is forward/backward, which one is sideway? I can't interpret your code without that info.

Author:  123girr [ Mon Dec 02, 2013 5:33 pm ]
Post subject:  Re: Segway Robot

here is a better bit of code, sorry
Code:
#pragma config(Motor,  port1,           Right,         tmotorVex393, openLoop)
#pragma config(Motor,  port10,          Left,          tmotorVex393, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{
     while(1)
     {
           motor[Right] = vexRT[AccelY] + vexRT[AccelX];
           motor[Left] = vexRT[AccelY] - vexRT[AccelX];
     }
}

And yes it does work. I used a basic joystick control program and just replaced the Ch# with the AccelX&Y
I am going to have it mounted to a pole off of a base. I don't think they need it to be life sized or even 2 wheeled and I don't want to spend however much for an extra gyro to keep it up straight. Currently though, I am just holding it and having fun with a clawbot. :)

Author:  MHTS [ Tue Dec 03, 2013 12:03 am ]
Post subject:  Re: Segway Robot

123girr wrote:
here is a better bit of code, sorry
Code:
#pragma config(Motor,  port1,           Right,         tmotorVex393, openLoop)
#pragma config(Motor,  port10,          Left,          tmotorVex393, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{
     while(1)
     {
           motor[Right] = vexRT[AccelY] + vexRT[AccelX];
           motor[Left] = vexRT[AccelY] - vexRT[AccelX];
     }
}

And yes it does work. I used a basic joystick control program and just replaced the Ch# with the AccelX&Y
I am going to have it mounted to a pole off of a base. I don't think they need it to be life sized or even 2 wheeled and I don't want to spend however much for an extra gyro to keep it up straight. Currently though, I am just holding it and having fun with a clawbot. :)

Your code does not show what AccelX and AccelY are. Are they the channels where you connected the X and Y axes of the accelerometer to? If so, the code seems way too simple. I would expect at least some sort of scaling of the raw accelerometer values before you can apply to the motor powers. I am not familiar with VEX, so I can't imagine how this code could work. Would you mind explaining your code and the configuration?
Also, what do you mean by not keeping it up straight? If the robot has more than 2 wheels or cannot balance by itself, it is not a Segway.

Author:  Ford Prefect [ Tue Dec 03, 2013 4:46 am ]
Post subject:  Re: Segway Robot

AccelX and AccelY sound like accelerometer data (pls CMIIW).
I honestly doubt that it would be possible ever to program a Segway-like self-balancing robot using just accelerometers. It simply doesn't exist a mathematical model for balancing an inverse pendulum (like a segway) by acceleration data neither by a formula nor by control and regulation loops.
OTOH there are lot of models which work with different sensors, e.g., distance sensors, but the best approach certainly is using a gyroscope.

edit:
the issue about accererometers is, e.g., that tilt/inclination and linear acceleration and centrifugal forces cannot be distinguished.

Author:  Ernest3.14 [ Tue Dec 03, 2013 10:14 pm ]
Post subject:  Re: Segway Robot

Well, couldn't you technically figure out the orientation of the pendulum by combining the x- and y- axis acceleration values, since gravity? Assuming the thing is oriented correctly, of course. It's waaaay more difficult than just using a gyro though :)

Author:  MHTS [ Wed Dec 04, 2013 2:28 am ]
Post subject:  Re: Segway Robot

There is a sample project on the new EV3 called Gyro Boy. It is a Segway bot that uses just the gyro. So it is possible.

Author:  123girr [ Wed Dec 04, 2013 4:11 pm ]
Post subject:  Re: Segway Robot

Yes, AccelX and AccelY are referring to the built in accelerometors in the vex joystick. Also, if you read my earlier comments, It is going to have four wheels. I don't need to worry about balancing it. A gyro is a bit out of my budget ($0).

Author:  MHTS [ Wed Dec 04, 2013 4:16 pm ]
Post subject:  Re: Segway Robot

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).

Author:  Ford Prefect [ Wed Dec 04, 2013 6:33 pm ]
Post subject:  Re: Segway Robot

correct.
a segway is a balancing bot. No balancing - no segway.
by 4 wheels it's just a car.

Author:  Ernest3.14 [ Wed Dec 04, 2013 9:13 pm ]
Post subject:  Re: Segway Robot

But it needs Ackermann steering to count as a car ;)

Page 1 of 2 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/