Add the following functionality to the SampleStage device
A set function, which accepts two parameters, the desired position for each motor:
The function checks to see if the parameters are within the limits of the motor, and throws a custom exception if they are not
Each motor checks the position it is currently at, and then checks its current velocity to see how long it will take to do the move.
Both motors should move to their positions at the same time, and throw a timeout error if it took longer than the time calculated above
Create a new class attribute called 'previous_positions', which is a list which updates every time the 'set' function is called, and keeps track of all the positions we moved to
Also create a 'read' function which returns the current value of motor x and the rotation motor. This should be in a dictionary format. Eg {'x': 0, 'A': 120}
Add the following functionality to the SampleStage device
A
set
function, which accepts two parameters, the desired position for each motor:The function checks to see if the parameters are within the limits of the motor, and throws a custom exception if they are not
Each motor checks the position it is currently at, and then checks its current velocity to see how long it will take to do the move.
Both motors should move to their positions at the same time, and throw a timeout error if it took longer than the time calculated above
Create a new class attribute called 'previous_positions', which is a list which updates every time the 'set' function is called, and keeps track of all the positions we moved to
Also create a 'read' function which returns the current value of motor x and the rotation motor. This should be in a dictionary format. Eg {'x': 0, 'A': 120}
Write tests for these as thoroughly as you can!