pub struct GenericPIDTask<I>{ /* private fields */ }Expand description
This is the Copper task encapsulating the PID controller.
Trait Implementations§
Source§impl<I> CuTask for GenericPIDTask<I>
impl<I> CuTask for GenericPIDTask<I>
type Input<'m> = CuStampedData<I, CuMsgMetadata>
type Output<'m> = CuStampedData<PIDControlOutputPayload, CuMsgMetadata>
Source§fn new(config: Option<&ComponentConfig>) -> CuResult<Self>where
Self: Sized,
fn new(config: Option<&ComponentConfig>) -> CuResult<Self>where
Self: Sized,
Here you need to initialize everything your task will need for the duration of its lifetime.
The config allows you to access the configuration of the task.
Source§fn process(
&mut self,
_clock: &RobotClock,
input: &Self::Input<'_>,
output: &mut Self::Output<'_>,
) -> CuResult<()>
fn process( &mut self, _clock: &RobotClock, input: &Self::Input<'_>, output: &mut Self::Output<'_>, ) -> CuResult<()>
Process is the most critical execution of the task.
The goal will be to produce the output message as soon as possible.
Use preprocess to prepare the task to make this method as short as possible.
Source§fn stop(&mut self, _clock: &RobotClock) -> CuResult<()>
fn stop(&mut self, _clock: &RobotClock) -> CuResult<()>
Called to stop the task. It signals that the *process method won’t be called until start is called again.
Source§fn start(&mut self, _clock: &RobotClock) -> Result<(), CuError>
fn start(&mut self, _clock: &RobotClock) -> Result<(), CuError>
Start is called between the creation of the task and the first call to pre/process.
Source§fn preprocess(&mut self, _clock: &RobotClock) -> Result<(), CuError>
fn preprocess(&mut self, _clock: &RobotClock) -> Result<(), CuError>
This is a method called by the runtime before “process”. This is a kind of best effort,
as soon as possible call to give a chance for the task to do some work before to prepare
to make “process” as short as possible.
Source§fn postprocess(&mut self, _clock: &RobotClock) -> Result<(), CuError>
fn postprocess(&mut self, _clock: &RobotClock) -> Result<(), CuError>
This is a method called by the runtime after “process”. It is best effort a chance for
the task to update some state after process is out of the way.
It can be use for example to maintain statistics etc. that are not time-critical for the robot.
Source§impl<I> Freezable for GenericPIDTask<I>
Store/Restore the internal state of the PID controller.
impl<I> Freezable for GenericPIDTask<I>
Store/Restore the internal state of the PID controller.
Auto Trait Implementations§
impl<I> Freeze for GenericPIDTask<I>
impl<I> RefUnwindSafe for GenericPIDTask<I>
impl<I> Send for GenericPIDTask<I>
impl<I> Sync for GenericPIDTask<I>
impl<I> Unpin for GenericPIDTask<I>
impl<I> UnwindSafe for GenericPIDTask<I>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more