Grasshopper

algorithmic modeling for Rhino

I am controlling 33 servos using the Generic Serial Write component and an Arduino Mega board. The goal is to send a different angle value to each servo. This works great with a slider. No issues there. However, as soon as I add a timer to the GH definition so that I can have the angles change on their own I get a ton of erratic behavior on many of the pins. The servos go to the angle they have been given but then they jump around. This is no ordinary jitter. They are acting as if new angle values are being sent to them when they are supposed to be holding one assigned value. The jump is a momentary and then the servo returns to the value it is supposed to hold. This only happens when each servo is being sent a different angle value. If I sent all of the servos the same value they hold their position just fine with the GH timer still running. The problem only shows up when each servo is assigned a different angle. I have been troubleshooting and narrowing things down to get to an understanding of what was happening. Some potentially useful observations:

-1 servo attached with the other 32 pins getting a LOW signal and the timer running has no problems

-as soon as a second servo is attached to the above set up, the jumpy behavior shows up

-the behavior gets worse the more servos are attached

-if I am sending the same value to 32 servos and a different value to the 33rd servo, that 33rd servo will exhibit the erratic behavior. Furthermore, the larger the differential between the angle value sent to the 33rd servo and the angle value sent to the other 32 servos the bigger the jumps the 33rd servo makes. 

-the behavior has been observed with different Mega boards and different servo brands

This piece is part of a larger definition that has a Kinect as one input, a set of buttons as another input, and a number of preset patterns that run for a set amount of time after no input has been detected. After that set amount of time a relay is switched to turn the power to the motors off. When either the Kinect or one of the buttons have been detected in this sleep mode, the set up wakes up and starts reacting to those inputs.

Has anyone encountered this issue? I am at a complete loss of how to solve it given that we need the timer in the GH definition to send the most current data. Is something getting messed up between the various data rates (timer + serial + Firefly Firmata loop)?

Views: 283

Replies to This Discussion

Additional note: The issue seems to be worse on the higher pin numbers (34-53) but also observed in the lower block (2-13) but with less frequency.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service