[][src]Trait ev3dev_lang_rust::tacho_motor::TachoMotor

pub trait TachoMotor: Motor {
    fn get_count_per_rot(&mut self) -> AttributeResult<isize> { ... }
fn get_count_per_m(&mut self) -> AttributeResult<isize> { ... }
fn get_full_travel_count(&mut self) -> AttributeResult<isize> { ... }
fn get_duty_cycle(&mut self) -> AttributeResult<isize> { ... }
fn get_duty_cycle_sp(&mut self) -> AttributeResult<isize> { ... }
fn set_duty_cycle_sp(&mut self, duty_cycle: isize) -> AttributeResult<()> { ... }
fn get_polarity(&mut self) -> AttributeResult<String> { ... }
fn set_polarity(&mut self, polarity: String) -> AttributeResult<()> { ... }
fn get_position(&mut self) -> AttributeResult<isize> { ... }
fn set_position(&mut self, position: isize) -> AttributeResult<()> { ... }
fn get_hold_pid_kp(&mut self) -> AttributeResult<f32> { ... }
fn set_hold_pid_kp(&mut self, kp: f32) -> AttributeResult<()> { ... }
fn get_hold_pid_ki(&mut self) -> AttributeResult<f32> { ... }
fn set_hold_pid_ki(&mut self, ki: f32) -> AttributeResult<()> { ... }
fn get_hold_pid_kd(&mut self) -> AttributeResult<f32> { ... }
fn set_hold_pid_kd(&mut self, kd: f32) -> AttributeResult<()> { ... }
fn get_max_speed(&mut self) -> AttributeResult<isize> { ... }
fn get_position_sp(&mut self) -> AttributeResult<isize> { ... }
fn set_position_sp(&mut self, position_sp: isize) -> AttributeResult<()> { ... }
fn get_speed(&mut self) -> AttributeResult<isize> { ... }
fn get_speed_sp(&mut self) -> AttributeResult<isize> { ... }
fn set_speed_sp(&mut self, speed_sp: isize) -> AttributeResult<()> { ... }
fn get_ramp_up_sp(&mut self) -> AttributeResult<isize> { ... }
fn set_ramp_up_sp(&mut self, ramp_up_sp: isize) -> AttributeResult<()> { ... }
fn get_ramp_down_sp(&mut self) -> AttributeResult<isize> { ... }
fn set_ramp_down_sp(&mut self, ramp_down_sp: isize) -> AttributeResult<()> { ... }
fn get_speed_pid_kp(&mut self) -> AttributeResult<f32> { ... }
fn set_speed_pid_kp(&mut self, kp: f32) -> AttributeResult<()> { ... }
fn get_speed_pid_ki(&mut self) -> AttributeResult<f32> { ... }
fn set_speed_pid_ki(&mut self, ki: f32) -> AttributeResult<()> { ... }
fn get_speed_pid_kd(&mut self) -> AttributeResult<f32> { ... }
fn set_speed_pid_kd(&mut self, kd: f32) -> AttributeResult<()> { ... }
fn get_state(&mut self) -> AttributeResult<Vec<String>> { ... }
fn get_stop_action(&mut self) -> AttributeResult<String> { ... }
fn set_stop_action(&mut self, stop_action: String) -> AttributeResult<()> { ... }
fn get_stop_actions(&mut self) -> AttributeResult<Vec<String>> { ... }
fn get_time_sp(&mut self) -> AttributeResult<isize> { ... }
fn set_time_sp(&mut self, time_sp: isize) -> AttributeResult<()> { ... }
fn run_direct(&mut self) -> AttributeResult<()> { ... }
fn run_forever(&mut self) -> AttributeResult<()> { ... }
fn run_to_abs_pos(
        &mut self,
        position_sp: Option<isize>
    ) -> AttributeResult<()> { ... }
fn run_to_rel_pos(
        &mut self,
        position_sp: Option<isize>
    ) -> AttributeResult<()> { ... }
fn run_timed(&mut self, time_sp: Option<isize>) -> AttributeResult<()> { ... }
fn stop(&mut self) -> AttributeResult<()> { ... }
fn reset(&mut self) -> AttributeResult<()> { ... }
fn is_running(&mut self) -> AttributeResult<bool> { ... }
fn is_ramping(&mut self) -> AttributeResult<bool> { ... }
fn is_holding(&mut self) -> AttributeResult<bool> { ... }
fn is_overloaded(&mut self) -> AttributeResult<bool> { ... }
fn is_stalled(&mut self) -> AttributeResult<bool> { ... } }

The tacho-motor class provides a uniform interface for using motors with positional and directional feedback such as the EV3 and NXT motors. This feedback allows for precise control of the motors.

Provided methods

fn get_count_per_rot(&mut self) -> AttributeResult<isize>

Returns the number of tacho counts in one rotation of the motor. Tacho counts are used by the position and speed attributes, so you can use this value to convert from rotations or degrees to tacho counts. (rotation motors only)

fn get_count_per_m(&mut self) -> AttributeResult<isize>

Returns the number of tacho counts in one meter of travel of the motor. Tacho counts are used by the position and speed attributes, so you can use this value to convert from distance to tacho counts. (linear motors only)

fn get_full_travel_count(&mut self) -> AttributeResult<isize>

Returns the number of tacho counts in the full travel of the motor. When combined with the count_per_m atribute, you can use this value to calculate the maximum travel distance of the motor. (linear motors only)

fn get_duty_cycle(&mut self) -> AttributeResult<isize>

Returns the current duty cycle of the motor. Units are percent. Values are -100 to 100.

fn get_duty_cycle_sp(&mut self) -> AttributeResult<isize>

Returns the current duty cycle setpoint of the motor. Units are in percent. Valid values are -100 to 100. A negative value causes the motor to rotate in reverse.

fn set_duty_cycle_sp(&mut self, duty_cycle: isize) -> AttributeResult<()>

Sets the duty cycle setpoint of the motor. Units are in percent. Valid values are -100 to 100. A negative value causes the motor to rotate in reverse.

fn get_polarity(&mut self) -> AttributeResult<String>

Returns the current polarity of the motor.

fn set_polarity(&mut self, polarity: String) -> AttributeResult<()>

Sets the polarity of the motor.

fn get_position(&mut self) -> AttributeResult<isize>

Returns the current position of the motor in pulses of the rotary encoder. When the motor rotates clockwise, the position will increase. Likewise, rotating counter-clockwise causes the position to decrease. The range is -2,147,483,648 and +2,147,483,647 tachometer counts (32-bit signed integer)

fn set_position(&mut self, position: isize) -> AttributeResult<()>

Sets the current position of the motor in pulses of the rotary encoder. When the motor rotates clockwise, the position will increase. Likewise, rotating counter-clockwise causes the position to decrease. The range is -2,147,483,648 and +2,147,483,647 tachometer counts (32-bit signed integer)

fn get_hold_pid_kp(&mut self) -> AttributeResult<f32>

Returns the proportional constant for the position PID.

fn set_hold_pid_kp(&mut self, kp: f32) -> AttributeResult<()>

Sets the proportional constant for the position PID.

fn get_hold_pid_ki(&mut self) -> AttributeResult<f32>

Returns the integral constant for the position PID.

fn set_hold_pid_ki(&mut self, ki: f32) -> AttributeResult<()>

Sets the integral constant for the position PID.

fn get_hold_pid_kd(&mut self) -> AttributeResult<f32>

Returns the derivative constant for the position PID.

fn set_hold_pid_kd(&mut self, kd: f32) -> AttributeResult<()>

Sets the derivative constant for the position PID.

fn get_max_speed(&mut self) -> AttributeResult<isize>

Returns the maximum value that is accepted by the speed_sp attribute. This value is the speed of the motor at 9V with no load. Note: The actual maximum obtainable speed will be less than this and will depend on battery voltage and mechanical load on the motor.

fn get_position_sp(&mut self) -> AttributeResult<isize>

Returns the current target position for the run-to-abs-pos and run-to-rel-pos commands. Units are in tacho counts. You can use the value returned by counts_per_rot to convert tacho counts to/from rotations or degrees. The range is -2,147,483,648 and +2,147,483,647 tachometer counts (32-bit signed integer).

fn set_position_sp(&mut self, position_sp: isize) -> AttributeResult<()>

Sets the target position for the run-to-abs-pos and run-to-rel-pos commands. Units are in tacho counts. You can use the value returned by counts_per_rot to convert tacho counts to/from rotations or degrees. The range is -2,147,483,648 and +2,147,483,647 tachometer counts (32-bit signed integer).

fn get_speed(&mut self) -> AttributeResult<isize>

Returns the current motor speed in tacho counts per second. Note, this is not necessarily degrees (although it is for LEGO motors). Use the count_per_rot attribute to convert this value to RPM or deg/sec.

fn get_speed_sp(&mut self) -> AttributeResult<isize>

Returns the target speed in tacho counts per second used for all run-* commands except run-direct. A negative value causes the motor to rotate in reverse with the exception of run-to-*-pos commands where the sign is ignored. Use the count_per_rot attribute to convert RPM or deg/sec to tacho counts per second. Use the count_per_m attribute to convert m/s to tacho counts per second.

fn set_speed_sp(&mut self, speed_sp: isize) -> AttributeResult<()>

Sets the target speed in tacho counts per second used for all run-* commands except run-direct. A negative value causes the motor to rotate in reverse with the exception of run-to-*-pos commands where the sign is ignored. Use the count_per_rot attribute to convert RPM or deg/sec to tacho counts per second. Use the count_per_m attribute to convert m/s to tacho counts per second.

fn get_ramp_up_sp(&mut self) -> AttributeResult<isize>

Returns the current ramp up setpoint. Units are in milliseconds and must be positive. When set to a non-zero value, the motor speed will increase from 0 to 100% of max_speed over the span of this setpoint. The actual ramp time is the ratio of the difference between the speed_sp and the current speed and max_speed multiplied by ramp_up_sp. Values must not be negative.

fn set_ramp_up_sp(&mut self, ramp_up_sp: isize) -> AttributeResult<()>

Sets the ramp up setpoint. Units are in milliseconds and must be positive. When set to a non-zero value, the motor speed will increase from 0 to 100% of max_speed over the span of this setpoint. The actual ramp time is the ratio of the difference between the speed_sp and the current speed and max_speed multiplied by ramp_up_sp. Values must not be negative.

fn get_ramp_down_sp(&mut self) -> AttributeResult<isize>

Returns the current ramp down setpoint. Units are in milliseconds and must be positive. When set to a non-zero value, the motor speed will decrease from 100% down to 0 of max_speed over the span of this setpoint. The actual ramp time is the ratio of the difference between the speed_sp and the current speed and 0 multiplied by ramp_down_sp. Values must not be negative.

fn set_ramp_down_sp(&mut self, ramp_down_sp: isize) -> AttributeResult<()>

Sets the ramp down setpoint. Units are in milliseconds and must be positive. When set to a non-zero value, the motor speed will decrease from 100% down to 0 of max_speed over the span of this setpoint. The actual ramp time is the ratio of the difference between the speed_sp and the current speed and 0 multiplied by ramp_down_sp. Values must not be negative.

fn get_speed_pid_kp(&mut self) -> AttributeResult<f32>

Returns the proportional constant for the speed regulation PID.

fn set_speed_pid_kp(&mut self, kp: f32) -> AttributeResult<()>

Sets the proportional constant for the speed regulation PID.

fn get_speed_pid_ki(&mut self) -> AttributeResult<f32>

Returns the integral constant for the speed regulation PID.

fn set_speed_pid_ki(&mut self, ki: f32) -> AttributeResult<()>

Sets the integral constant for the speed regulation PID.

fn get_speed_pid_kd(&mut self) -> AttributeResult<f32>

Returns the derivative constant for the speed regulation PID.

fn set_speed_pid_kd(&mut self, kd: f32) -> AttributeResult<()>

Sets the derivative constant for the speed regulation PID.

fn get_state(&mut self) -> AttributeResult<Vec<String>>

Returns a list of state flags.

fn get_stop_action(&mut self) -> AttributeResult<String>

Returns the current stop action. The value determines the motors behavior when command is set to stop.

fn set_stop_action(&mut self, stop_action: String) -> AttributeResult<()>

Sets the stop action. The value determines the motors behavior when command is set to stop.

fn get_stop_actions(&mut self) -> AttributeResult<Vec<String>>

Returns a list of stop actions supported by the motor controller.

fn get_time_sp(&mut self) -> AttributeResult<isize>

Returns the current amount of time the motor will run when using the run-timed command. Units are in milliseconds. Values must not be negative.

fn set_time_sp(&mut self, time_sp: isize) -> AttributeResult<()>

Sets the amount of time the motor will run when using the run-timed command. Units are in milliseconds. Values must not be negative.

fn run_direct(&mut self) -> AttributeResult<()>

fn run_forever(&mut self) -> AttributeResult<()>

fn run_to_abs_pos(&mut self, position_sp: Option<isize>) -> AttributeResult<()>

fn run_to_rel_pos(&mut self, position_sp: Option<isize>) -> AttributeResult<()>

fn run_timed(&mut self, time_sp: Option<isize>) -> AttributeResult<()>

fn stop(&mut self) -> AttributeResult<()>

fn reset(&mut self) -> AttributeResult<()>

fn is_running(&mut self) -> AttributeResult<bool>

fn is_ramping(&mut self) -> AttributeResult<bool>

fn is_holding(&mut self) -> AttributeResult<bool>

fn is_overloaded(&mut self) -> AttributeResult<bool>

fn is_stalled(&mut self) -> AttributeResult<bool>

Loading content...

Implementors

impl TachoMotor for LargeMotor[src]

fn get_count_per_rot(&mut self) -> AttributeResult<isize>[src]

fn get_count_per_m(&mut self) -> AttributeResult<isize>[src]

fn get_full_travel_count(&mut self) -> AttributeResult<isize>[src]

fn get_duty_cycle(&mut self) -> AttributeResult<isize>[src]

fn get_duty_cycle_sp(&mut self) -> AttributeResult<isize>[src]

fn set_duty_cycle_sp(&mut self, duty_cycle: isize) -> AttributeResult<()>[src]

fn get_polarity(&mut self) -> AttributeResult<String>[src]

fn set_polarity(&mut self, polarity: String) -> AttributeResult<()>[src]

fn get_position(&mut self) -> AttributeResult<isize>[src]

fn set_position(&mut self, position: isize) -> AttributeResult<()>[src]

fn get_hold_pid_kp(&mut self) -> AttributeResult<f32>[src]

fn set_hold_pid_kp(&mut self, kp: f32) -> AttributeResult<()>[src]

fn get_hold_pid_ki(&mut self) -> AttributeResult<f32>[src]

fn set_hold_pid_ki(&mut self, ki: f32) -> AttributeResult<()>[src]

fn get_hold_pid_kd(&mut self) -> AttributeResult<f32>[src]

fn set_hold_pid_kd(&mut self, kd: f32) -> AttributeResult<()>[src]

fn get_max_speed(&mut self) -> AttributeResult<isize>[src]

fn get_position_sp(&mut self) -> AttributeResult<isize>[src]

fn set_position_sp(&mut self, position_sp: isize) -> AttributeResult<()>[src]

fn get_speed(&mut self) -> AttributeResult<isize>[src]

fn get_speed_sp(&mut self) -> AttributeResult<isize>[src]

fn set_speed_sp(&mut self, speed_sp: isize) -> AttributeResult<()>[src]

fn get_ramp_up_sp(&mut self) -> AttributeResult<isize>[src]

fn set_ramp_up_sp(&mut self, ramp_up_sp: isize) -> AttributeResult<()>[src]

fn get_ramp_down_sp(&mut self) -> AttributeResult<isize>[src]

fn set_ramp_down_sp(&mut self, ramp_down_sp: isize) -> AttributeResult<()>[src]

fn get_speed_pid_kp(&mut self) -> AttributeResult<f32>[src]

fn set_speed_pid_kp(&mut self, kp: f32) -> AttributeResult<()>[src]

fn get_speed_pid_ki(&mut self) -> AttributeResult<f32>[src]

fn set_speed_pid_ki(&mut self, ki: f32) -> AttributeResult<()>[src]

fn get_speed_pid_kd(&mut self) -> AttributeResult<f32>[src]

fn set_speed_pid_kd(&mut self, kd: f32) -> AttributeResult<()>[src]

fn get_state(&mut self) -> AttributeResult<Vec<String>>[src]

fn get_stop_action(&mut self) -> AttributeResult<String>[src]

fn set_stop_action(&mut self, stop_action: String) -> AttributeResult<()>[src]

fn get_stop_actions(&mut self) -> AttributeResult<Vec<String>>[src]

fn get_time_sp(&mut self) -> AttributeResult<isize>[src]

fn set_time_sp(&mut self, time_sp: isize) -> AttributeResult<()>[src]

fn run_direct(&mut self) -> AttributeResult<()>[src]

fn run_forever(&mut self) -> AttributeResult<()>[src]

fn run_to_abs_pos(&mut self, position_sp: Option<isize>) -> AttributeResult<()>[src]

fn run_to_rel_pos(&mut self, position_sp: Option<isize>) -> AttributeResult<()>[src]

fn run_timed(&mut self, time_sp: Option<isize>) -> AttributeResult<()>[src]

fn stop(&mut self) -> AttributeResult<()>[src]

fn reset(&mut self) -> AttributeResult<()>[src]

fn is_running(&mut self) -> AttributeResult<bool>[src]

fn is_ramping(&mut self) -> AttributeResult<bool>[src]

fn is_holding(&mut self) -> AttributeResult<bool>[src]

fn is_overloaded(&mut self) -> AttributeResult<bool>[src]

fn is_stalled(&mut self) -> AttributeResult<bool>[src]

impl TachoMotor for MediumMotor[src]

fn get_count_per_rot(&mut self) -> AttributeResult<isize>[src]

fn get_count_per_m(&mut self) -> AttributeResult<isize>[src]

fn get_full_travel_count(&mut self) -> AttributeResult<isize>[src]

fn get_duty_cycle(&mut self) -> AttributeResult<isize>[src]

fn get_duty_cycle_sp(&mut self) -> AttributeResult<isize>[src]

fn set_duty_cycle_sp(&mut self, duty_cycle: isize) -> AttributeResult<()>[src]

fn get_polarity(&mut self) -> AttributeResult<String>[src]

fn set_polarity(&mut self, polarity: String) -> AttributeResult<()>[src]

fn get_position(&mut self) -> AttributeResult<isize>[src]

fn set_position(&mut self, position: isize) -> AttributeResult<()>[src]

fn get_hold_pid_kp(&mut self) -> AttributeResult<f32>[src]

fn set_hold_pid_kp(&mut self, kp: f32) -> AttributeResult<()>[src]

fn get_hold_pid_ki(&mut self) -> AttributeResult<f32>[src]

fn set_hold_pid_ki(&mut self, ki: f32) -> AttributeResult<()>[src]

fn get_hold_pid_kd(&mut self) -> AttributeResult<f32>[src]

fn set_hold_pid_kd(&mut self, kd: f32) -> AttributeResult<()>[src]

fn get_max_speed(&mut self) -> AttributeResult<isize>[src]

fn get_position_sp(&mut self) -> AttributeResult<isize>[src]

fn set_position_sp(&mut self, position_sp: isize) -> AttributeResult<()>[src]

fn get_speed(&mut self) -> AttributeResult<isize>[src]

fn get_speed_sp(&mut self) -> AttributeResult<isize>[src]

fn set_speed_sp(&mut self, speed_sp: isize) -> AttributeResult<()>[src]

fn get_ramp_up_sp(&mut self) -> AttributeResult<isize>[src]

fn set_ramp_up_sp(&mut self, ramp_up_sp: isize) -> AttributeResult<()>[src]

fn get_ramp_down_sp(&mut self) -> AttributeResult<isize>[src]

fn set_ramp_down_sp(&mut self, ramp_down_sp: isize) -> AttributeResult<()>[src]

fn get_speed_pid_kp(&mut self) -> AttributeResult<f32>[src]

fn set_speed_pid_kp(&mut self, kp: f32) -> AttributeResult<()>[src]

fn get_speed_pid_ki(&mut self) -> AttributeResult<f32>[src]

fn set_speed_pid_ki(&mut self, ki: f32) -> AttributeResult<()>[src]

fn get_speed_pid_kd(&mut self) -> AttributeResult<f32>[src]

fn set_speed_pid_kd(&mut self, kd: f32) -> AttributeResult<()>[src]

fn get_state(&mut self) -> AttributeResult<Vec<String>>[src]

fn get_stop_action(&mut self) -> AttributeResult<String>[src]

fn set_stop_action(&mut self, stop_action: String) -> AttributeResult<()>[src]

fn get_stop_actions(&mut self) -> AttributeResult<Vec<String>>[src]

fn get_time_sp(&mut self) -> AttributeResult<isize>[src]

fn set_time_sp(&mut self, time_sp: isize) -> AttributeResult<()>[src]

fn run_direct(&mut self) -> AttributeResult<()>[src]

fn run_forever(&mut self) -> AttributeResult<()>[src]

fn run_to_abs_pos(&mut self, position_sp: Option<isize>) -> AttributeResult<()>[src]

fn run_to_rel_pos(&mut self, position_sp: Option<isize>) -> AttributeResult<()>[src]

fn run_timed(&mut self, time_sp: Option<isize>) -> AttributeResult<()>[src]

fn stop(&mut self) -> AttributeResult<()>[src]

fn reset(&mut self) -> AttributeResult<()>[src]

fn is_running(&mut self) -> AttributeResult<bool>[src]

fn is_ramping(&mut self) -> AttributeResult<bool>[src]

fn is_holding(&mut self) -> AttributeResult<bool>[src]

fn is_overloaded(&mut self) -> AttributeResult<bool>[src]

fn is_stalled(&mut self) -> AttributeResult<bool>[src]

Loading content...