segway help
4 posters
RigidChips :: Rigid-Chips :: Files :: Others
Page 1 of 1
segway help
i am having trouble with it stopping, and with turning
any tips?
- Code:
// [RCD]
Val
{
BRAKES(default=0, max=50)
LEAN(default=0, min=-60, max=90, step=5)
LWHEEL(default=0, min=-50000, max=50000)
RWHEEL(default=0, min=-50000, max=50000)
TURNING(default=0, min=-100, max=100, step=100)
}
Key
{
0:LEAN(step=5)
1:LEAN(step=-5)
2:TURNING(step=-100)
3:TURNING(step=100)
}
Body
{
Core() {
S:Frame(angle=-120) {
S:Frame(angle=-150) {
S:Chip(color=#0000FF) {
S:Chip(color=#0000FF) {
N:Trim(angle=90, color=#8080FF) {
S:Chip(color=#8080FF) {
S:Frame(angle=120) {
S:RLW(angle=-120, power=-LWHEEL, brake=BRAKES) { }
}
S:Frame(angle=-120) {
S:RLW(angle=120, power=-RWHEEL, brake=BRAKES) { }
}
}
}
N:RLW(angle=180, power=500) { }
}
E:Trim(angle=90) {
E:Frame(option=1) { }
}
W:TrimF(angle=90, option=1) {
S:Arm(angle=180) { }
}
E:Frame(angle=LEAN, option=1) {
E:Frame(option=1) { }
}
W:Frame(angle=LEAN, option=1) {
W:Frame(option=1) { }
}
}
}
}
}
}
Script
{LWHEEL=_AX(core)*10000-TURNING
RWHEEL=_AX(core)*10000+TURNING
BRAKES=_WX(core)*2}
any tips?
Sting Auer- Hover
- Posts : 170
Join date : 2010-09-19
Location : Aw crap i think I'm lost.
Re: segway help
Stopping and starting is probably a balance issue. Make it go forward if it's leaning too far forward, and back when it's leaning too far back. Then it should stand still and do nothing, but at least not fall over. After that, just make it so pressing forward just makes it lean forward more, and it will automatically accelerate to keep from falling over. Ironically, this means that the first thing it will do when you press forward is go backwards.
I'm not sure what to do about turning. There's only so fast you can do a friction-based turn. If you don't mind cheating a bit, you can just put jets on the wheels, and make them cancel the left/right component.
I'm not sure what to do about turning. There's only so fast you can do a friction-based turn. If you don't mind cheating a bit, you can just put jets on the wheels, and make them cancel the left/right component.
DanielLC- Tank
- Posts : 78
Join date : 2010-10-23
Re: segway help
Or you can use some awesome leaning stuff so that the centre of gravity counteracts the inertia of the model as you turn!
JHaskly- Admin
- Posts : 235
Join date : 2010-07-16
Age : 28
Location : Brisbane
Re: segway help
IMO a better way to balance would be trying to get _GX() and _GY() as close as possible to the wheels _X() and _Y().
RA2lover- Walker
- Posts : 382
Join date : 2010-10-11
Age : 29
Location : Brazil
Re: segway help
here is a newer version. it is moving better but now it doesnt work AT ALL on uneven ground. it just falls over on the slightest uphill or downhill slope.
it turns better now, and it can stop itself better now.
- Code:
// [RCD]
Val
{
BRAKES(default=0, max=50)
GETUP(default=0, min=-180, max=180, step=10)
LEAN(default=0, min=-60, max=90, step=5)
LWHEEL(default=0, min=-3000, max=3000)
RWHEEL(default=0, min=-3000, max=3000)
TURNING(default=0, min=-500, max=500, step=100)
}
Key
{
0:LEAN(step=5)
1:LEAN(step=-5)
2:TURNING(step=-100)
3:TURNING(step=100)
14:GETUP(step=5)
16:GETUP(step=-5)
}
Body
{
Core() {
S:Frame(angle=-120) {
S:Frame(angle=-150) {
S:Chip(color=#0000FF) {
S:Chip(color=#0000FF) {
N:Trim(angle=90, color=#8080FF) {
S:Chip(color=#8080FF) {
S:Frame(angle=120) {
S:Frame(angle=-30) {
S:RLW(angle=-90, power=-LWHEEL, brake=BRAKES) { }
}
}
S:Frame(angle=-120) {
S:Frame(angle=30) {
S:RLW(angle=90, power=-RWHEEL, brake=BRAKES) { }
}
}
}
}
N:Frame(angle=GETUP) {
N:Frame() { }
}
S:Frame(angle=100) {
S:Frame() { }
}
S:Frame(angle=-100) {
S:Frame() { }
}
}
E:Trim(angle=90) {
E:Frame(option=1) { }
}
W:TrimF(angle=90, option=1) {
S:Arm(angle=180) { }
}
S:Frame(angle=LEAN, option=1) {
S:Frame(option=1) {
S:Frame(option=1) { }
}
}
}
}
}
}
}
Script
{LWHEEL=_AX(core)*10000-TURNING
RWHEEL=_AX(core)*10000+TURNING
BRAKES=_WX(core)*5}
it turns better now, and it can stop itself better now.
Sting Auer- Hover
- Posts : 170
Join date : 2010-09-19
Location : Aw crap i think I'm lost.
Re: segway help
Is there a way to tell the slope of the ground? If so, make it so it automatically pushes itself uphill to counter out that it would otherwise tend to go down. If not, you might be able to add a variable to figure it out based on how far it is from where it should be leaning.
To keep it from falling down, you could either add a zero onto _AX(core)*10000, or you could add a multiple of _AX(core)^3 so that it starts pushing a lot harder when it starts falling down.
It would be more elegant to use (_AX(core)-LEANING). This way it will just use the wheels to adjust to the angle it should be at.
You can stop that rocking back and forth by adding an artificial friction. Make it slow down the rotation. Basically, find how much _AX(core) is changing, and add a multiple of that. Is that what _WX() does?
If you want it to stop on its own, make it adjust LEANING based on its speed. Or just have it add a multiple of its speed into the power of its wheels.
You should probably take out the breaks. The way it balances shouldn't depend on how fast it goes.
To keep it from falling down, you could either add a zero onto _AX(core)*10000, or you could add a multiple of _AX(core)^3 so that it starts pushing a lot harder when it starts falling down.
It would be more elegant to use (_AX(core)-LEANING). This way it will just use the wheels to adjust to the angle it should be at.
You can stop that rocking back and forth by adding an artificial friction. Make it slow down the rotation. Basically, find how much _AX(core) is changing, and add a multiple of that. Is that what _WX() does?
If you want it to stop on its own, make it adjust LEANING based on its speed. Or just have it add a multiple of its speed into the power of its wheels.
You should probably take out the breaks. The way it balances shouldn't depend on how fast it goes.
DanielLC- Tank
- Posts : 78
Join date : 2010-10-23
Re: segway help
Yes, that's what _W*() do.
Or you could do math.sgn(_AX(0))*_AX(0)^2
sidenote: Since the core is always chip 0, you can write 0 instead of core.
RA2Lover = the closer the centre of gravity, the slower it goes.
Or you could do math.sgn(_AX(0))*_AX(0)^2
sidenote: Since the core is always chip 0, you can write 0 instead of core.
RA2Lover = the closer the centre of gravity, the slower it goes.
JHaskly- Admin
- Posts : 235
Join date : 2010-07-16
Age : 28
Location : Brisbane
RigidChips :: Rigid-Chips :: Files :: Others
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum