Stop position commands #137
-
I'm sending a position command to my actuators, they fulfill the demand fine - this happens due to a fulfilled if-statement within a While Loop. When I try to send velocity commands after the if-statement has been fulfilled it bugs on my. It's like the position command is still active. Can I somehow stop the position command for affecting the actuators after fulfilled the first time? Best,
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Rasmus, Thanks for reaching out. My guess here is that you are using a CommandStruct/GroupCommand which still has position commands in it. The solution here is either to clear the position command from the CommandStruct/GroupCommand, or to use a new CommandStruct/GroupCommand object. If you let me know which API you are using, I can give more explicit code samples, but generally the documentation for this object in MATLAB, Python, and C++ can be found here: However, there could be a lot of things going on here -- if this isn't the issue, would you be able to share a code snippet here, and describe a little more about what exactly is happening? Best,
|
Beta Was this translation helpful? Give feedback.
-
Hi Matt, I'm using the GroupCommand in Python. My code looks like this: A main while loop is running while i use a Mobile Device to control actuators.
I get feedback from the motors and then try to command a specific position if a specific button is pressed:
I hope this makes sense, coding is not my strong side. Also, can I combine the actuators in one group and command them individually? Best,
|
Beta Was this translation helpful? Give feedback.
-
Rasmus, Sorry for the late reply. Thanks for sharing the code snippets -- I can point out a few things here that should help and may address the problem. I don't see any velocity commands, though. If you are able to share a full file, I can provide more complete feedback; alternatively, I would be happy to have a short call to walk through some of your questions here as well. If that would help, email [email protected] and cc me ([email protected]) and we'll get you set up. Regarding the code samples: Block 1 -- mobile feedback: The overall approach you have here should work, but I want to point out a couple notes that should fix some bugs that I think will crop up. First, note that the Instead, I recommend using the following pattern here:
The second block of code is straightforward, but I would note that there is an extra copy here b/c the "reuse_fbk" argument is not the same as the returned data:
This means that you are writing the data into group_feedback1, and then also copying that into fbk_a1. I expect you only need one of these variables. Also, you should check the return value before using fbk_a1, as this could be "None" if the connection to the module timed out, and unwrapping that value later will cause a crash. Finally, in the third block -- this is a little concerning, because you seem to be commanding a large "jump" in position here -- over a full rotation of the actuator in a single timestep. Depending on the gains that are set on this module and the available power supply, this may even result in a large sudden power draw into the actuator which decreases the voltage available on the power bus, resetting the modules. Instead, you should update the position incrementally (see the other post you had where I referenced some of the "trajectory" tools we have). As a couple of references: Simple single module trajectory: Full system trajectories with mobile IO: (Note that the actuator command parts of this code have been replaced in our main code branch by use of the "arm" API for controlling full robot arms, so this is an older non-main branch that should be closer to your use case)
|
Beta Was this translation helpful? Give feedback.
-
Whoops -- missed your last question there. You can combine the actuators into one group, but still index into the commands to send individual values for commands. However, when you call "send command", messages are sent to all actuators in the group with their respective commands; you cannot just send to a single member of the group. Best,
|
Beta Was this translation helpful? Give feedback.
Rasmus,
Sorry for the late reply.
Thanks for sharing the code snippets -- I can point out a few things here that should help and may address the problem. I don't see any velocity commands, though. If you are able to share a full file, I can provide more complete feedback; alternatively, I would be happy to have a short call to walk through some of your questions here as well. If that would help, email [email protected] and cc me ([email protected]) and we'll get you set up.
Regarding the code samples:
Block 1 -- mobile feedback:
The overall approach you have here should work, but I want to point out a couple notes that should fix some bugs that I think will crop up. First, note…