go_away

Author Topic: AXON2 startup jitter with webbotlib.  (Read 1637 times)

0 Members and 1 Guest are viewing this topic.

Offline happy_hippoTopic starter

  • Jr. Member
  • **
  • Posts: 45
  • Helpful? 0
AXON2 startup jitter with webbotlib.
« on: October 12, 2011, 06:39:36 PM »
Every time I use default Project Designer code (with AXON2) I get servo movement at startup. I want to start my robot with all servos off (I have 18 of them, software PWM).  I tried adding the following code, but it didn't work:

Code: [Select]
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
servosDisconnect(&bank1);
servosDisconnect(&bank2);
servosDisconnect(&bank3);
return 0;
}

I still get all servos move for a fraction of a second (just as I hit the hardware power switch) before turning off.

Any suggestions? Thanks
« Last Edit: October 12, 2011, 06:41:02 PM by happy_hippo »
??? -> :D

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,121
  • Helpful? 108
Re: AXON2 startup jitter with webbotlib.
« Reply #1 on: October 14, 2011, 06:01:26 AM »
As soon as the processor starts sending a signal to the servo then the servo will move to that position. The chances of the servo having been left in that exact position from the last time they were being used is very slim. So the jitter is probably just the servos moving to their initial position in the short delay before you disconnect them.

WebbotLib assumes that all servos should start off as being connected so the only way to do a 'proper fix' would be for me to add a tick box in Project Designer to say whether the servo starts off as connected or disconnected. However: as soon as you connect a servo in your own code then the servo will still 'jump' to its initial position.

Are you using Version 1 or Version 2 of WebbotLib? I can then tell you how to change the generated code to do what you are asking and you can see if it works (before I make any changes to Project Designer). In the meantime it will mean you having to remake the change every time you do a code generation from Project Designer as it will overwrite your changes.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,632
  • Helpful? 169
    • Society of Robots
Re: AXON2 startup jitter with webbotlib.
« Reply #2 on: October 14, 2011, 06:11:29 AM »
Servo jitter during startup is a flaw in the servos themselves. When power is ramped up, the position system gets all flaky for a fraction of a second.

You can verify this by directly connecting a battery to a servo and watching what happens.

Offline happy_hippoTopic starter

  • Jr. Member
  • **
  • Posts: 45
  • Helpful? 0
Re: AXON2 startup jitter with webbotlib.
« Reply #3 on: October 14, 2011, 08:42:48 AM »

Are you using Version 1 or Version 2 of WebbotLib? I can then tell you how to change the generated code to do what you are asking and you can see if it works (before I make any changes to Project Designer). In the meantime it will mean you having to remake the change every time you do a code generation from Project Designer as it will overwrite your changes.

Webbot ! you are so supportive! Big thanks to you. I'm using version 2 of Webbotlib.
??? -> :D

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,121
  • Helpful? 108
Re: AXON2 startup jitter with webbotlib.
« Reply #4 on: October 14, 2011, 08:58:01 AM »
I'm using version 2 of Webbotlib.

In the 'lib' folder of your project you will find a file called 'gen_xxxxxx.c'  where 'xxxxxx' is the name of your servo bank in Project Designer (so you may have more than one).

Towards the bottom of the file there will be a function called 'xxxxxxx_Init(SERVO_DRIVER* driver)' which has a 'for' loop to initialise each servo.
Change this line:-
Code: [Select]
// Re-connect the servo
act_setConnected(servo,TRUE);

so that it doesn't connect the servo at startup:-
Code: [Select]
// Dis-connect the servo
act_setConnected(servo,FALSE);

Then re-compile your project.

As I said previously: you will need to do this after every code generation from Project Designer.
If you still get jitter - then re-read what Admin said previously.

Let me know whether it does what you want, or not.

« Last Edit: October 14, 2011, 09:02:28 AM by Webbot »
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline happy_hippoTopic starter

  • Jr. Member
  • **
  • Posts: 45
  • Helpful? 0
Re: AXON2 startup jitter with webbotlib.
« Reply #5 on: October 14, 2011, 09:16:26 AM »
Let me know whether it does what you want, or not.

Unfortunately it didn't work, it gives almost exactly the same effect as putting a disconnect command in the software initialization function.

Well, anyway, it's not a big problem. But it's probably more a hardware thing, may something like an inductor in series with the battery can solve this? (or a capacitor in parallel with each servo?)


Servo jitter during startup is a flaw in the servos themselves. When power is ramped up, the position system gets all flaky for a fraction of a second.

You can verify this by directly connecting a battery to a servo and watching what happens.
As I understand the command servosDisconnect(&bank1) completely disconnects power supply to servos, because it makes my servos lose all torque, so I can move them with my hand. Why is it not possible to start the AXON without providing power to servos at start-up? Thanks


Thanks
« Last Edit: October 14, 2011, 09:45:11 AM by happy_hippo »
??? -> :D

Offline Gertlex

  • Supreme Robot
  • *****
  • Posts: 742
  • Helpful? 23
  • Nuclear Engineer Roboticist
Re: AXON2 startup jitter with webbotlib.
« Reply #6 on: October 14, 2011, 06:11:41 PM »
Fairly related question...

Using AX-12 servos with an Axon... When I power servos then power on the axon, some servos will zero themselves, but others won't...  Varies depending on which project code I have loaded to the Axon.  This doesn't happen when the code doesn't use AX-12s, though.

Is there a way to disable the sending of signals initially? I looked for a similar line in the various files in the lib folder.  I also looked at changing when the UART being used is enabled... couldn't find that either - it looks like UARTs are initialized differently than I was used to pre-WebbotLib 2.
I

Offline happy_hippoTopic starter

  • Jr. Member
  • **
  • Posts: 45
  • Helpful? 0
Re: AXON2 startup jitter with webbotlib.
« Reply #7 on: October 16, 2011, 03:22:56 AM »
Fairly related question...

Using AX-12 servos with an Axon... When I power servos then power on the axon, some servos will zero themselves, but others won't...  Varies depending on which project code I have loaded to the Axon.  This doesn't happen when the code doesn't use AX-12s, though.


All of my servos always zero themselves when I start AXON 2  (with Webbotlib 2.0 files generated with project designer). I think Webbotlib 2.0 automatically zeros them on startup somewhere in the project-generated hardware files.
??? -> :D

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,121
  • Helpful? 108
Re: AXON2 startup jitter with webbotlib.
« Reply #8 on: October 16, 2011, 12:54:00 PM »
As I understand the command servosDisconnect(&bank1) completely disconnects power supply to servos, because it makes my servos lose all torque, so I can move them with my hand. Why is it not possible to start the AXON without providing power to servos at start-up? Thanks
In basic terms:- there are 3 wires to your servo ground, power and signal. As soon as you turn on your board the servo will receive power (WebbotLib cannot pull out the cables!). But if the servo is 'disconnected' within WebbotLib then it wont send any pulses down the signal line. So the servo goes all floppy but its still getting power. I believe Admins point (and I may be wrong) was that the servo may twitch at the moment the power is supplied but then go floppy since its not getting any signal.

The WebbotLib ability to connect and disconnect servos is only supported if WebbotLib is driving the signals (ie via hardware PWM or via software PWM) or if the 3rd party servo board supports such a concept (some don't such as the AX12s). I originally added these calls into WebbotLib when working with continuous rotation servos whereby 'disconnect' causes a loss of torque and therefore allows the wheel to coast versus setting a speed of 0 which means brake.

All of the servo drivers in WebbotLib will initialise the servo as being connected and the speed set to 0 (ie centered for a non-continuous servo).
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,632
  • Helpful? 169
    • Society of Robots
Re: AXON2 startup jitter with webbotlib.
« Reply #9 on: October 18, 2011, 11:13:00 AM »
Quote
All of the servo drivers in WebbotLib will initialise the servo as being connected and the speed set to 0 (ie centered for a non-continuous servo).
Is that good for something like a hexapod, where you don't want the servos initialized at 0?

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,121
  • Helpful? 108
Re: AXON2 startup jitter with webbotlib.
« Reply #10 on: October 18, 2011, 02:21:34 PM »
Quote
All of the servo drivers in WebbotLib will initialise the servo as being connected and the speed set to 0 (ie centered for a non-continuous servo).
Is that good for something like a hexapod, where you don't want the servos initialized at 0?

Hard one for me to answer!
If they aren't initialized at 0 then 'at what?' (you can change the actual values to be non-0 very early on in appInitSoftware)-
or if they should be left 'disconnected' by default  then everyones projects will need to decide at what point to manually 'connect' the servos in their code. Newbs will complain that their servos do nothing (coz they forgot to 'connect' them).
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline happy_hippoTopic starter

  • Jr. Member
  • **
  • Posts: 45
  • Helpful? 0
Re: AXON2 startup jitter with webbotlib.
« Reply #11 on: October 18, 2011, 02:55:35 PM »
What I found, as Webbot mentioned, that it's very easy to disconnect the servos in appInitSoftware (although there's an initial "kick" in servos as they get their power, as Admin mentioned), but you can set their positions while they are disconnected, either in appInitSoftware or in the main program loop, and connect your servos. In this case the effect is similar to starting in some particular position, apart from that initial "kick". But it's not a big problem.  ::)
??? -> :D

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,632
  • Helpful? 169
    • Society of Robots
Re: AXON2 startup jitter with webbotlib.
« Reply #12 on: October 18, 2011, 10:44:30 PM »
Quote
All of the servo drivers in WebbotLib will initialise the servo as being connected and the speed set to 0 (ie centered for a non-continuous servo).
Is that good for something like a hexapod, where you don't want the servos initialized at 0?

Hard one for me to answer!
If they aren't initialized at 0 then 'at what?' (you can change the actual values to be non-0 very early on in appInitSoftware)-
or if they should be left 'disconnected' by default  then everyones projects will need to decide at what point to manually 'connect' the servos in their code. Newbs will complain that their servos do nothing (coz they forgot to 'connect' them).
How about this . . . a checkbox in Project Designer that by default is checked that says something like 'Activate All Servos at Startup'. Easy for noobs, powerful enough for experts :P

 


Get Your Ad Here