fossasia/pslab-python

Implement Robotic Arm

Opened this issue · 0 comments

This is a parent issue for robotic arm-related issues in pslab-python. @rahul31124

In broad strokes, the goal is to implement a robotic arm instrument in pslab-python, mirroring the functionality of the robotic arm instrument in pslab-android.

  1. Implement RoboticArm class in external.motor

pslab-python already has a Servo class. The RoboticArm can reuse this class:

class RoboticArm:
    MAX_SERVOS = 4
    def __init__(self, servos: list[Servo]) -> None:
        if (len(servos > RoboticArm.MAX_SERVOS)):
            raise ValueError(f"At most {RoboticArm.MAX_SERVOS} can be used, got {len(servos)}")
        self.servos = servos
        ...

The RoboticArm, when activated, should manipulate the position of each Servo over time. This will require keeping some kind of schedule. The equivalent logic from pslab-android can likely be ported to Python.

  1. Implement time-dependent position schedule for Servos

The RoboticArm should be able to import its configuration from pslab-android's robotic arm instrument via the CSV which pslab-android can already generate. The RoboticArm should also be able to export its position schedule to CSV which pslab-android can import. Python has built-in CSV support via the csv module which should be suitable for this task.

  1. Implement position schedule import/export via CSV

These tasks should be sufficient to reach parity with pslab-android's robotic arm.

As a possible enhancement, the RoboticArm could bypass the Servo class and use PWMGenerator directly. This could improve responsiveness, but an initial implementation should use Servo first to see if there is any need for improvement.