I have the same thing, or at least something similar. With me, it usually happens when I'm trying to sleep or when I'm very tired. It's kind of like restless leg syndrome, but it isn't; I have that too and know what it feels like and this is different. I definitely notice when I have it because it drives me nuts! My right foot flaps vigorously up and down a few seconds at a time - sometimes just a few times and that's all, sometimes it happens several times a minute and goes on for hours. If I'm on my back or front, my foot flaps up and down, if I'm on my side, it usually flaps side to side.
This has happened since having a tumor removed from the left hemisphere of my brain near the area that controls my right leg. At first, I thought it was just a spasm, but I had other spasms after surgery, and all the others went away. I have noticed that it tends to be worse if I break down and have a diet drink with aspartame, or when I have too many carbs, but I don't think those things actually cause the problem, just aggravate it.
I asked my neurosurgeon if it could be some sort of seizure, and, without thinking about it much, he said it could be and suggested adding another drug. But I don't want to just throw more drugs at it if it isn't seizure related, I feel crappy enough
I'm getting used to it, but I do worry that if it is seizure activity, I could be letting my brain create those pathways that will one day lead to worse seizures.
Sorry, didn't mean to ramble on so long