Struct picoborgrev::PicoBorgRev [−][src]
Methods
impl<T: Read + Write + WriteRead> PicoBorgRev<T>
[src]
impl<T: Read + Write + WriteRead> PicoBorgRev<T>
pub fn new(device: T) -> Result<PicoBorgRev<T>, <T as WriteRead>::Error>
[src]
pub fn new(device: T) -> Result<PicoBorgRev<T>, <T as WriteRead>::Error>
pub fn set_motor_1(&mut self, power: f32) -> Result<(), <T as Write>::Error>
[src]
pub fn set_motor_1(&mut self, power: f32) -> Result<(), <T as Write>::Error>
Sets the drive level for motor 1, from +1 to -1.
pub fn set_motor_2(&mut self, power: f32) -> Result<(), <T as Write>::Error>
[src]
pub fn set_motor_2(&mut self, power: f32) -> Result<(), <T as Write>::Error>
Sets the drive level for motor 2, from +1 to -1
pub fn set_motors(&mut self, power: f32) -> Result<(), <T as Write>::Error>
[src]
pub fn set_motors(&mut self, power: f32) -> Result<(), <T as Write>::Error>
Sets the drive level for all motors, from +1 to -1.
pub fn motors_off(&mut self) -> Result<(), <T as Write>::Error>
[src]
pub fn motors_off(&mut self) -> Result<(), <T as Write>::Error>
Sets all motors to stopped, useful when ending a program
pub fn get_motor_1(&mut self) -> Result<f32, <T as WriteRead>::Error>
[src]
pub fn get_motor_1(&mut self) -> Result<f32, <T as WriteRead>::Error>
Gets the drive level for motor 1, from +1 to -1.
pub fn get_motor_2(&mut self) -> Result<f32, <T as WriteRead>::Error>
[src]
pub fn get_motor_2(&mut self) -> Result<f32, <T as WriteRead>::Error>
Gets the drive level for motor 1, from +1 to -1.
pub fn set_led(&mut self, state: bool) -> Result<(), <T as Write>::Error>
[src]
pub fn set_led(&mut self, state: bool) -> Result<(), <T as Write>::Error>
Sets the current state of the Led, False for off, True for on
pub fn get_led(&mut self) -> Result<bool, <T as WriteRead>::Error>
[src]
pub fn get_led(&mut self) -> Result<bool, <T as WriteRead>::Error>
Reads the current state of the Led, False for off, True for on
pub fn reset_epo(&mut self) -> Result<(), <T as Write>::Error>
[src]
pub fn reset_epo(&mut self) -> Result<(), <T as Write>::Error>
Resets the Epo latch state, use to allow movement again after the Epo has been tripped.
pub fn get_epo(&mut self) -> Result<bool, <T as WriteRead>::Error>
[src]
pub fn get_epo(&mut self) -> Result<bool, <T as WriteRead>::Error>
Reads the system Epo latch state.
If false
the Epo has not been tripped, and movement is allowed.
If true
the Epo has been tripped, movement is disabled if the Epo
is not ignored (see set_epo_ignore
).
Movement can be re-enabled by calling reset_epo
.
pub fn set_epo_ignore(&mut self, state: bool) -> Result<(), <T as Write>::Error>
[src]
pub fn set_epo_ignore(&mut self, state: bool) -> Result<(), <T as Write>::Error>
Sets the system to ignore or use the Epo latch, set to false
if you
have an Epo switch, true
if you do not.
pub fn get_epo_ignore(&mut self) -> Result<bool, <T as WriteRead>::Error>
[src]
pub fn get_epo_ignore(&mut self) -> Result<bool, <T as WriteRead>::Error>
Reads the system Epo ignore state, false
for using the Epo latch,
true
for ignoring the Epo latch.
pub fn set_comms_failsafe(
&mut self,
state: bool
) -> Result<(), <T as Write>::Error>
[src]
pub fn set_comms_failsafe(
&mut self,
state: bool
) -> Result<(), <T as Write>::Error>
Sets the system to enable or disable the communications failsafe.
The failsafe will turn the motors off unless it is commanded at least
once every 1/4 of a second.
Set to true
to enable this failsafe or set to false
to disable.
The failsafe is disabled at power on.
pub fn get_comms_failsafe(&mut self) -> Result<bool, <T as WriteRead>::Error>
[src]
pub fn get_comms_failsafe(&mut self) -> Result<bool, <T as WriteRead>::Error>
Read the current system state of the communications failsafe, true
for enabled, false
for disabled. The failsafe will turn the motors
off unless it is commanded at least once every 1/4 of a second.
pub fn get_drive_fault(&mut self) -> Result<bool, <T as WriteRead>::Error>
[src]
pub fn get_drive_fault(&mut self) -> Result<bool, <T as WriteRead>::Error>
Reads the system drive fault state, False for no problems, True for a fault has been detected. Faults may indicate power problems, such as under-voltage (not enough power), and may be cleared by setting a lower drive power.
If a fault is persistent, it repeatably occurs when trying to control the board, this may indicate a wiring problem such as:
- The supply is not powerful enough for the motors
- The board has a bare minimum requirement of 6V to operate correctly
- A recommended minimum supply of 7.2V should be sufficient for smaller motors
- The + and - connections for either motor are connected to each other
- Either + or - is connected to ground (Gnd, also known as 0V or earth)
- Either + or - is connected to the power supply (V+, directly to the battery or power pack)
- One of the motors may be damaged
Faults will self-clear, they do not need to be reset, however some faults require both motors to be moving at less than 100% to clear. The easiest way to check is to put both motors at a low power setting which is high enough for them to rotate easily, such as 30%. Note that the fault state may be true at power up, this is normal and should clear when both motors have been driven.
If there are no faults but you cannot make your motors move check
get_epo
to see if the safety switch has been tripped.
For more details check the website at www.piborg.org/picoborgrev and double check the wiring instructions.
pub fn set_encoder_move_mode(
&mut self,
state: bool
) -> Result<(), <T as Write>::Error>
[src]
pub fn set_encoder_move_mode(
&mut self,
state: bool
) -> Result<(), <T as Write>::Error>
Sets the system to enable or disable the encoder based move mode. In
encoder move mode (enabled) the encoder_move_motor*
commands are
available to move fixed distances. In non-encoder move mode
(disabled) the set_motor*
commands should be used to set drive
levels.
The encoder move mode requires that the encoder feedback is attached to an encoder signal, see the website at www.piborg.org/picoborgrev for wiring instructions.
The encoder based move mode is disabled at power on.
pub fn get_encoder_move_mode(&mut self) -> Result<bool, <T as WriteRead>::Error>
[src]
pub fn get_encoder_move_mode(&mut self) -> Result<bool, <T as WriteRead>::Error>
Read the current system state of the encoder based move mode, true
for enabled (encoder moves), false
for disabled (power level moves)
pub fn encoder_move_motor_1(
&mut self,
counts: i16
) -> Result<(), <T as Write>::Error>
[src]
pub fn encoder_move_motor_1(
&mut self,
counts: i16
) -> Result<(), <T as Write>::Error>
Moves motor 1 until it has seen a number of encoder counts, up to 32767 Use negative values to move in reverse
pub fn encoder_move_motor_2(
&mut self,
counts: i16
) -> Result<(), <T as Write>::Error>
[src]
pub fn encoder_move_motor_2(
&mut self,
counts: i16
) -> Result<(), <T as Write>::Error>
Moves motor 2 until it has seen a number of encoder counts. Use negative values to move in reverse.
pub fn encoder_move_motors(
&mut self,
counts: i16
) -> Result<(), <T as Write>::Error>
[src]
pub fn encoder_move_motors(
&mut self,
counts: i16
) -> Result<(), <T as Write>::Error>
Moves all motors until it has seen a number of encoder counts. Use negative values to move in reverse.
pub fn is_encoder_moving(&mut self) -> Result<bool, <T as WriteRead>::Error>
[src]
pub fn is_encoder_moving(&mut self) -> Result<bool, <T as WriteRead>::Error>
Reads the current state of the encoder motion, false
for all motors
have finished, true
for any motor is still moving.
pub fn wait_while_encoder_moving(
&mut self,
timeout: Duration
) -> Result<bool, <T as WriteRead>::Error>
[src]
pub fn wait_while_encoder_moving(
&mut self,
timeout: Duration
) -> Result<bool, <T as WriteRead>::Error>
Waits until all motors have finished performing encoder based moves
If the motors stop moving the function will return true
or if the
timeout
occurs it will return false
.
pub fn set_encoder_speed(
&mut self,
power: f32
) -> Result<(), <T as Write>::Error>
[src]
pub fn set_encoder_speed(
&mut self,
power: f32
) -> Result<(), <T as Write>::Error>
Sets the drive limit for encoder based moves, from 0 to 1.
pub fn get_encoder_speed(&mut self) -> Result<f32, <T as WriteRead>::Error>
[src]
pub fn get_encoder_speed(&mut self) -> Result<f32, <T as WriteRead>::Error>
Gets the drive limit for encoder based moves, from 0 to 1.
Trait Implementations
Auto Trait Implementations
impl<T> Send for PicoBorgRev<T> where
T: Send,
impl<T> Send for PicoBorgRev<T> where
T: Send,
impl<T> Sync for PicoBorgRev<T> where
T: Sync,
impl<T> Sync for PicoBorgRev<T> where
T: Sync,