Society of Robots - Robot Forum

Software => Software => Topic started by: dellagd on February 13, 2010, 10:00:07 AM

Title: Webbot lib with omnibots
Post by: dellagd on February 13, 2010, 10:00:07 AM
hey form-ers of SoR, got a question on webbot's library.
I am planning on using  webbot lib for my soon to be omni bot with an Axon II
now for an omnibot, full forward, full backwards, and stop will not work. I need
to be able to have direct control over the servos speed. I was looking through the documentation on webbot lib and didn't find anything like what I am talking about. am I just not seeing it or is that functionality not in webbot lib?
Title: Re: Webbot lib with omnibots
Post by: dunk on February 13, 2010, 10:53:12 AM
hi Dellagd
this is an issue with servos rather than a software thing.
different servos implement speed in different ways.

before you modify a servo you tell a servo the position you want it to move to and the best servos go there at full speed.

that's *not* to say the best servos make the best continuous rotation servos once you modify them though.
in fact the opposite can be true.

so some servos will only have 2 accurate speeds: full speed and stop. these are typically the more expensive ones.
others will have a some in between states but you'll need to play your self to calibrate the speed.

sorry to be so vague.
maybe someone on here knows a good model of servo thats speed scales nicely?


dunk.
Title: Re: Webbot lib with omnibots
Post by: dellagd on February 13, 2010, 11:11:59 AM
thats not what I asked
I was wondering how to put servos to a specific position using webbot lib (or in continuous rotation a certain speed)
Title: Re: Webbot lib with omnibots
Post by: dunk on February 13, 2010, 11:52:25 AM
yea, after re-reading your post i suppose it wasn't. (it will still be an issue though.)

if you have a look in the WebbotLib-1-XX.pdf in the WebbotLib zip file there is a good example on how to do this on a simple photovore robot.

dunk.
Title: Re: Webbot lib with omnibots
Post by: Webbot on February 13, 2010, 12:47:41 PM
thats not what I asked
I was wondering how to put servos to a specific position using webbot lib (or in continuous rotation a certain speed)

Continuous rotation servos are treated like DC motors (in WebbotLib).
So all of the commands from 'actuators.h' apply. So you can set the speed, read the last issued speed command, disconnect them etc etc. As dunk says this the photovore example shows some of these commands.

If the servos are un-modified then the same 'act_Speed' call is used - but where min speed is the full counter-clockwise position (same as as 'full speed reverse' for a modified servo) and max speed is the full clockwise rotation (same as 'full speed ahead' for a modified servo).

If you are using Project Designer and you bring in a servo then the examples.txt file will contain some example code. If the servo is modifed then this will vary the servo between full reverse and full ahead (and speeds in-between). For an unmodified servo you will see the servo swing between it min and max positions.



Title: Re: Webbot lib with omnibots
Post by: Admin on February 13, 2010, 10:38:08 PM
In my photovore example code, you'll see:

Code: [Select]
act_setSpeed(&left_wheel,DRIVE_SPEED_MIN);
act_setSpeed(&right_wheel,DRIVE_SPEED_MAX);

With an omni-wheel bot, you end up doing fractions of full speed, calculated using trig. Sooo . . .

Code: [Select]
float fractionA;
float fractionB;

calculate_fractions();

act_setSpeed(&left_wheel,DRIVE_SPEED_MAX*fractionA);
act_setSpeed(&right_wheel,DRIVE_SPEED_MAX*fractionB);


edit: fixed it to be floats - dumb mistake!
Title: Re: Webbot lib with omnibots
Post by: Webbot on February 13, 2010, 10:51:48 PM
Well you probably need 'fractionA' and 'fractionB' to be floating point numbers eg 'double' or 'float'. Otherwise your 'setSpeed' calls will only be 0, DRIVE_SPEED_MAX or -DRIVE_SPEED_MAX (ie stop, full fwds, full reverse)

If they are floating point and hold any value between -1 and +1 then it would work.

There are other ways - which avoid use of floating point maths. The photovore example in the manual has an example.
.
Title: Re: Webbot lib with omnibots
Post by: dellagd on February 14, 2010, 09:56:24 AM
for a second, just forget the whole trig calculations and such

if I want to set a continuous rotation servo to any speed I'll just toy around with the "0" after the "&right, " until I get what speed and direction I want? like how I see -127 is DRIVE_SPEED_MIN.

Code: [Select]
act_setSpeed(&right,0);
Title: Re: Webbot lib with omnibots
Post by: Razor Concepts on February 14, 2010, 01:20:10 PM
if I want to set a continuous rotation servo to any speed I'll just toy around with the "0" after the "&right, " until I get what speed and direction I want?

Yup  :)
Title: Re: Webbot lib with omnibots
Post by: dellagd on February 14, 2010, 02:21:48 PM
ok thank you!