Skip to content

Feature request: MOVE_JOG support #34

Open
@andelf

Description

@andelf

Guess from decoding the protocol:

1rad/s
ID=0x1200fd7f data=[05, 70, 00, 00, 07, 01, 84, 43]
    pub async fn move_jog_stop(&mut self, motor_id: u8) -> Status {
        self.send_raw_mesage(
            motor_id,
            protocol::WRITE_PARAM,
            &[0x05, 0x70, 0x00, 0x00, 0x07, 0x00, 0x7f, 0xff],
        );

        self.receive_response().await
    }

    /// speed: -30 to 30, rad/s
    pub async fn move_jog(&mut self, motor_id: u8, speed: f32, clockwise: bool) -> Status {
        if speed < 0.05 {
            return self.move_jog_stop(motor_id).await;
        }
        let speed = if clockwise { speed } else { -speed };
        let speed = map_f32_to_u16(speed, -30.0, 30.0);

        let mut data = [0u8; 8];

        // UNDOCUMENTED, guess from reverse engineering
        data[0..2].copy_from_slice(&u16::to_le_bytes(params::RUN_MODE));
        data[4] = 0x07;
        data[5] = 1;
        data[6..8].copy_from_slice(&u16::to_be_bytes(speed));

        self.send_raw_mesage(motor_id, protocol::WRITE_PARAM, &data);

        self.receive_response().await
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions