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

Segway
http://robotc.net/forums/viewtopic.php?f=41&t=2153
Page 1 of 1

Author:  gcelia [ Tue Feb 02, 2010 6:43 am ]
Post subject:  Segway

Hello,
I am working with RobtC on a segway, and I don't know how to do to keep the robot in balance; I think that I must use for this the gyroscopes.
Any one for help?
Thanks.

Author:  hdima [ Tue Feb 02, 2010 8:15 am ]
Post subject:  Re: Segway

Same question: a program to balance the robot with RobotC....
Please

Author:  mightor [ Tue Feb 02, 2010 8:19 am ]
Post subject:  Re: Segway

Is this a homework assignment?

Xander

Author:  hdima [ Wed Feb 03, 2010 5:13 am ]
Post subject:  Re: Segway

No, it's not. It is my own initiative.

Author:  mightor [ Wed Feb 03, 2010 5:15 am ]
Post subject:  Re: Segway

Did you Google for it? As far as I know there are several Segway-like robots on the Net that use ROBOTC. I believe there are even a couple on these forums.

Regards,
Xander

Author:  hdima [ Thu Feb 04, 2010 2:03 am ]
Post subject:  Re: Segway

Of, course; It's the first thing that I did. I found also codes in this forum, like this one, but I don't understand them. Can you please explain it to me?

task main(){

int ng, gn=590, nw=0, rp=0, rg, lrp=0, rwi=0, md;
bFloatDuringInactiveMotorPWM=true;

while(true){

ng=SensorRaw(S1)-gn;
nw+=ng; //robot angle
rp=nMotorEncoder(B); //wheel position
rg=rp-lrp;
lrp=rp;
rwi+=rg; //wheel speed
if (abs(rwi)>15){

gn-=sgn(rwi);
rwi=0;

}
//Gyro drift comp.
md=(nw+ng*12+rp*5+rg*360)>>5; //pd contr. RXC large wheels
md=(nw+ng*10+rp*4+rg*200)>>4; //pd contr. NXT small wheels
md+=sgn(md)*48; //friction compensation
motor[motorB]=motor[motorC]=md;
wait1Msec(10); //while loop

}

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