I am using a Micro Maestro 6 to control a slide motion table in my project. As I need to control the speed, acceleration and power of servo whenever I set a target pos, I’m modifying the UscCmd C# project to insert an additional option in it.
But what I noticed is some feature is not being set in the controller:
- Set Speed, Accel, Pos of servo.
- Wait for servo to reach target.
- Send pos 0 to servo to disable it’s power.
- Send another pos to servo with different speed and accel.
- Notice this time speed and accel is reset back to 0, only pos is working.
Is it becasue I am sending pos 0 to servo on every cmd which causes this problem?
How do I fix it because I need my servo to power down after reaching a pos to prevent it from overheating.
''''''
else if (opts["set"] != null)
{
string[] parts = opts["set"].Split(',');
if (parts.Length != 4)
opts.error("Wrong number of commas in the argument.");
byte servo = 0;
ushort pos = 0;
ushort speed = 0;
byte accel=0 ;
servo = byte.Parse(parts[0]);
pos = ushort.Parse(parts[1]);
speed = ushort.Parse(parts[2]);
accel = byte.Parse(parts[3]);
//Set Speed
usc.setSpeed(servo, speed);
//Set Accel
usc.setAcceleration(servo, accel);
//Set Pos
usc.setTarget(servo, pos);
//Wait for servo to reach target
ServoStatus[] target;
do
{
Thread.Sleep(100);
device.getVariables(out target);
} while (target[servo].position != pos);
//Disable servo power to prevent over heating
usc.setTarget(servo, 0);
//Clear Error
usc.clearErrors();
}