Command Strategy in Python Script

Questions about our Python API
Post Reply
abdulaleey
Posts: 15
Joined: Wed Aug 26, 2020 2:52 am

Command Strategy in Python Script

Post by abdulaleey » Sun Oct 18, 2020 9:42 pm

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.
User avatar
florian_enner
HEBI Official
Posts: 33
Joined: Wed Mar 25, 2020 11:31 am
Location: Austria

Re: Command Strategy in Python Script

Post by florian_enner » Sun Oct 18, 2020 10:11 pm

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.
User avatar
hardik_singh
HEBI Official
Posts: 13
Joined: Thu Jul 09, 2020 10:49 am

Re: Command Strategy in Python Script

Post by hardik_singh » Sun Oct 18, 2020 10:18 pm

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.
abdulaleey
Posts: 15
Joined: Wed Aug 26, 2020 2:52 am

Re: Command Strategy in Python Script

Post by abdulaleey » Sun Oct 18, 2020 10:43 pm

Thank you very much I do understand.
Post Reply