Python and Mobile I/O development

Questions about our Python API
Post Reply
HD-Lab_Rasmus
Posts: 5
Joined: Tue Feb 16, 2021 12:31 pm

Python and Mobile I/O development

Post by HD-Lab_Rasmus » Tue Feb 16, 2021 12:38 pm

Hi,

I received some x-actuators and I quickly managed to get them spinning in Scope and Python using, for instance, the “03a_command_position.py” from the Basis folder on the HEBI Github.

I would like to use a mobile device to control the motors using the Mobile I/O and Python, but the Python scripts I managed to find are either explicitly for an Arm like “ex_mobile_io_control.py” or for getting feedback from a Mobile device.

Does anyone have an example for Python where a Mobile device is used for setting positions and/or velocities for individual motors? Or experience with the same?

Regards,
Rasmus
User avatar
hardik_singh
HEBI Official
Posts: 13
Joined: Thu Jul 09, 2020 10:49 am

Re: Python and Mobile I/O development

Post by hardik_singh » Thu Feb 18, 2021 5:56 pm

Hi Rasmus,

We don't have an example that explicitly controls individual actuators using mobileIO, but the examples you are looking at do - for the most part - cover everything you would need. I would add that walking through the python API documentation at docs.hebi.us should help illuminate relevant concepts as well (in particular, the part about trajectories).

Tips as you go through these resources:
  • 03a_position_command.py introduces how to send a command to a specific position to an actuator on the network. Example 03d shows how to do position and velocity simultaneously.
  • When we create a 'group' of actuators, this primarily helps us to locate and communicate on loop with the appropriate actuators on the network. For your robot, you can have all relevant actuators in a group, but still send them separate position and velocity commands.
  • The trajectories documentation shows one way to command position and velocities to multiple actuators in a given group. In this case, you feed the positions and velocity values you want as a matrix, and our trajectory generator helps with creating a motion profile that your actuators can follow. You may not want to use this setup initially, but using the trajectories eventually can make the motion for your robot smoother and safer.
  • ex_mobile_io_control exhibits how you can map behaviors / commands to different buttons on mobileIO. After you have set up your mobile device (lines 23 to 34) the list of if-statements show how you can set different behaviors for different button presses.
The examples are meant to give you a starting point, and in your case I believe it would make sense to adapt ex_mobile_io_control.py to your needs. Replace the arm setup code (lines 9-20) with your setup code for your actuators (as in the /basics examples), and replace the contents of the if-statements to do what you want at each button press.

Probably more info than you were looking for, but hope it helps!
- Hardik
Post Reply