Can you post the code you are using, as well as a picture or schematic of your setup?
When you use the servo.attach(pinNum) function, the servo moves to its middle position (90 degrees for a 180 degree servo). If you want, you can use servo.write() immediately before servo.attach() and it should prevent the sudden jerk.I also notice that you have no delay in your loop() segment from the end of walk() to the beginning of stand(). Is this intentional?
The delay() function takes in an argument of the number of milliseconds to pause the execution of the program. For instance, "delay(5000)" pauses the program for 5000 milliseconds, or 5 seconds. A nice starting spot is to use the same amount of delay that you use between stand() and walk(). Try adding the same delay after walk() and let me know what happens.
Do you think 50ms is enough? I just noticed that you have the stand() function inside your walk() function as well. Is this intentional?
Great. So now you are only calling the stand() function every 5 seconds or so. Is the behavior you observed earlier still occurring?
Did you try to add the write() before attach() like I suggested? Does this help at all?Try replacing stand() with walk() in the loop() portion (also try with and without stand() in your walk() function)