Forum
Dear SoloTeam,
I have to log the torque of an brushed DC Motor via Python. The Solo is connected via USB to an Windows PC.
Logging via SoloPy and 'get_dc_motor_current_im()' is to slow (max 60 Hz with reducing the sleeping time in __excec_cmd. Is there an easy way to do that with 200 Hz?
Best regards
Flo
Dear @flo
Moving the reading of the torque from 60 Hz to 200 Hz is an hard challenge, and it will require a bigger effort then common tasks.
I personally suggest you to avoid asking to the SOLO unit the torque in high frequency request, as this option can reduce the motion performances.
An alternative approach is to use the “monitoring mode”, you can see an implementation in the Motion terminal > “Performance Mode (500Hz)” section. When you activate or deactivate the feature, what happens behind the scene in JavaScript is:
- When you activate the mode: a new packet will be sent to the SOLO unit. You can read more about the command used in the UART_USB communication manual > page 31 “0x19 : Monitoring Modes Enable/Disable”
- the SOLO unit will keep send back data with all the information (torque too) and they are plotted in the Motion terminal.
- When you stop the mode: a new packet will be sent to the SOLO unit, so it will stop to keep sending data.
You can learn it by checking the Motion terminal code, here the Motion Terminal repository, is Open Source, mostly JavaScript based. Actually the support of the Monitoring mode command is not supported on Python.
The possible alternative solutions, based on your application goal and restrictions:
- You can modify the JavaScript source code using it to logging all the information you need.
- You can Make a Python implementation of the monitoring mode command. I suggest you to start from empty Python code, implement the monitoring mode command feature (you can follow the JS approach) and then add the commands you need.