Page 1 of 1

Command Strategy in Python Script

Posted: Sun Oct 18, 2020 9:42 pm
by abdulaleey
My query is related to control modes. If I try to give command of control strategy in python script, the actuator always stops working but it runs fine when I give command from scope with the same control strategy.

Like I give command

group_command=hebi.GroupCommand(group.size)
group_command.control_strategy = ['Strategy4']
group.send_command(group_command)

after setting the above in python script when I give velocity command in loop my actuator doesn't work. I guess there is something wrong with setting command strategy. kindly let me know about this.

Re: Command Strategy in Python Script

Posted: Sun Oct 18, 2020 10:11 pm
by florian_enner
This is likely related to the command lifetime. By default, APIs send a "life time" (a user specified timeout) of 250ms, so sending a single command would result in a small movement and almost immediately turn off. You would need to send commands in a loop.

This feature prevents unpredictable/harmful behavior in case a program crashes, and also serves as a "lock" that prevents an actuator to receive commands from other sources. You can find more information at https://docs.hebi.us/core_concepts.html#commands

Scope specifies a lifetime of zero, which means that a a command lasts indefinitely, but also does not lock the actuator.

Re: Command Strategy in Python Script

Posted: Sun Oct 18, 2020 10:18 pm
by hardik_singh
Alternatively, we generally recommend setting control strategies the same way you set gains - by loading a gains.xml file.

Looking at the documentation here you'll find that the gains.xml file is structured to include a control strategy parameter for each of the actuators in your system. In this way, you don't need to programmatically set your control strategies in your code - it should get easily loaded as a part of the gains file for your system.

Re: Command Strategy in Python Script

Posted: Sun Oct 18, 2020 10:43 pm
by abdulaleey
Thank you very much I do understand.