RoboticArm.export_timeline_to_csv always writes a four-servo header, but each row only has as many values as the arm has servos. import_timeline_from_csv always returns four angles per timestep, but run_schedule requires exactly one per servo. As a result, neither direction works for an arm with 1–3 servos.
pwm = MagicMock()
arm = RoboticArm([Servo("SQ1", pwm), Servo("SQ2", pwm)])
arm.export_timeline_to_csv([[10, 20], [30, None]], "out")
The exported file has short rows:
Timestep,Servo1,Servo2,Servo3,Servo4
0,10,20
1,30,null
- Importing that file raises
TypeError: int() argument must be ... not 'NoneType' because row["Servo3"] is None.
- Importing a complete four-column file (
0,10,20,null,null) returns [[10, 20, None, None]], and arm.run_schedule(...) then raises ValueError: Each timestep must specify an angle for every servo.
Expected: a timeline exported from an arm can be imported by that same arm and run. Suggested fix: the export pads rows with null up to four servos, keeping the four-column format; the import returns one angle per servo on the arm and rejects a file that sets an angle for a servo the arm doesn't have.
RoboticArm.export_timeline_to_csvalways writes a four-servo header, but each row only has as many values as the arm has servos.import_timeline_from_csvalways returns four angles per timestep, butrun_schedulerequires exactly one per servo. As a result, neither direction works for an arm with 1–3 servos.The exported file has short rows:
TypeError: int() argument must be ... not 'NoneType'becauserow["Servo3"]isNone.0,10,20,null,null) returns[[10, 20, None, None]], andarm.run_schedule(...)then raisesValueError: Each timestep must specify an angle for every servo.Expected: a timeline exported from an arm can be imported by that same arm and run. Suggested fix: the export pads rows with
nullup to four servos, keeping the four-column format; the import returns one angle per servo on the arm and rejects a file that sets an angle for a servo the arm doesn't have.