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

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

Author:  Ford Prefect [ Thu Dec 05, 2013 3:36 am ]
Post subject:  Re: Segway Robot

ok, then it's probably not even a car :)

Author:  123girr [ Fri Dec 06, 2013 5:15 pm ]
Post subject:  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!

Author:  Ford Prefect [ Fri Dec 06, 2013 5:54 pm ]
Post subject:  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).

Author:  123girr [ Tue Dec 10, 2013 4:13 pm ]
Post subject:  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.

Author:  MHTS [ Tue Dec 10, 2013 4:26 pm ]
Post subject:  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.

Author:  JohnWatson [ Tue Dec 10, 2013 4:50 pm ]
Post subject:  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

Author:  123girr [ Tue Jan 07, 2014 5:19 pm ]
Post subject:  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"?

Author:  123girr [ Tue Jan 07, 2014 5:34 pm ]
Post subject:  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.

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