dora-rs / dora-lerobot

Lerobot boosted with dora
Apache License 2.0
63 stars 6 forks source link

Better Node-hub with Poetry and Better Position Control #18

Closed Hennzau closed 3 months ago

Hennzau commented 3 months ago

In this short PR I managed to make a good use of pip and poetry.

Structure

Code

I also had time to:

   with open(os.environ.get("LEADER_CONTROL") as file:
        leader_control = json.load(file)

    leader_position = physical_to_logical(leader_position, leader_control)

See ./robots/alexk-lcr/nodes/interpolate_lcr_to_lcr.py

Apache Arrow

I decided to use Arrow format almost everywhere, but I don't know if it's good. In one hand it allows you to do that

# retrieve data from dynamixel bus
node.send_output("position", pa.array([self.bus.read_position(self.config["joints"])]), metadata)

# send data to dynamixel bus
joints = goal_position[0]["joints"].values
goal_position = goal_position[0]["values"].values
self.bus.write_goal_position(goal_position, joints)

But in another hand it's far more complicated to work on values (compared to numpy)

interpolation = pa.array([1, 1, 1, 1, 1, 700 / 450], type=pa.float32())

leader_position = pa.scalar({
    "joints": leader_position["joints"].values,
    "values": pa.array(pc.multiply(leader_position["values"].values, interpolation)),
}, type=ARROW_LOGICAL_VALUES)

Please tell me if you should use arrow format everywhere