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

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

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)

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)

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)

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

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.

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.

Returns the current polarity of the motor.

Sets the polarity of the motor.

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)

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)

Returns the proportional constant for the position PID.

Sets the proportional constant for the position PID.

Returns the integral constant for the position PID.

Sets the integral constant for the position PID.

Returns the derivative constant for the position PID.

Sets the derivative constant for the position PID.

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.

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).

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).

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.

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.

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.

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.

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.

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.

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.

Returns the proportional constant for the speed regulation PID.

Sets the proportional constant for the speed regulation PID.

Returns the integral constant for the speed regulation PID.

Sets the integral constant for the speed regulation PID.

Returns the derivative constant for the speed regulation PID.

Sets the derivative constant for the speed regulation PID.

Returns a list of state flags.

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

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

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

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.

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

Implementors