gantrylib.md
crane
Crane
A class representing the gantrycrane.
__enter__()
Enter the runtime context for the crane.
Returns: |
|
---|
__exit__(exc_type, exc_value, traceback)
Exit the runtime context and clean up resources.
Parameters: |
|
---|
__init__(gantryPort, hoistPort, angleUARTPort, gantryUARTPort, calibrated=False, I_max=1)
Initializes a Crane instance.
Parameters: |
|
---|
executeWaypointsPosition()
Attempt to execute the waypoints in position mode.
Works by setting the waypoint and altering the motor's velocity limit as the trajectory moves along.
Returns: |
|
---|
homeAllAxes()
Homes all axes.
Hoiststepper isn't homed, since we don't have a proper automated homing procedure for it.
homeGantry()
Homes the cart on the gantry
readAngle()
Reads the latest received angle from the angleUART
Returns: |
|
---|
setWaypoints(waypoints)
Sets the waypoints to be executed by the crane.
Parameters: |
|
---|
motors
Motor
A class representing a motor.
__init__(port, pulley_circumference, I_max)
Initializes a Motor instance.
Parameters: |
|
---|
getPosition()
Get the current position.
Returns: |
|
---|
getTorque()
Get the actually exerted torque.
Returns: |
|
---|
getVelocity()
Get the current velocity.
Returns: |
|
---|
setAccelLimit(acc)
Set acceleration limit.
Parameters: |
|
---|
setLimits(acc, vel)
Set acceleration and velocity limits.
Parameters: |
|
---|
setPosition(pos)
Set the current position.
Parameters: |
|
---|
setPositionMode()
Set motor driver to position mode
setTorque(tgt)
Set the target torque.
Note: assumes printer is in torque mode. Printer can be set in torque mode with setTorqueMode.
Parameters: |
|
---|
setTorqueMode()
Set motor drive to torque mode.
setVelocity(vel)
Set the current velocity
Parameters: |
|
---|
setVelocityLimit(vel)
Set velocity limit.
Parameters: |
|
---|
setVelocityMode()
Set motor driver to velocity mode
Stepper
Bases: Motor
Specialization of the Motor class into a Stepper motor.
__init__(port, pulley_diameter, I_max)
Initialize a Stepper instance.
GantryStepper
Bases: Stepper
Specializes stepper into the gantry stepper, that is the motor that does the lateral movement.
__init__(port, calibrated=False, I_max=1)
Initializes an instance of GantryStepper.
Parameters: |
|
---|
HoistStepper
Bases: Stepper
Specializes stepper into the hoist stepper, that is the motor that does the hoisting movement.
__init__(port, calibrated=False, I_max=1)
Initializes an instance of GantryStepper.
Parameters: |
|
---|
trajectory_generator
TrajectoryGenerator
A class to generate an optimal trajectory that moves the crane laterally from one position to another one.
__init__(properties_file)
Initialize a TrajectoryGenerator instance.
Parameters: |
|
---|
generateTrajectory(start, stop)
Generates an optimal, monotone trajectory from start to stop, adhering to the limits imposed by the configurationfile used to create the TrajectoryGenerator
Parameters: |
|
---|
Returns: |
|
---|
generateTrajectoryLQR(start, stop)
Generates an optimal trajectory using a Linear Quadratic Regulator
Parameters: |
|
---|
Returns: |
|
---|
saveDataToMat(filename, data, keys)
Save output to a .mat file.
Parameters: |
|
---|
saveParamToMat(filename)
Save the parameters of this current trajectory generator to a mat file.
Parameters: |
|
---|
saveToCSV(filename, data, columnnames)
Save output to CSV file.
Parameters: |
|
---|
gantry_controller
GantryController
A class representing a controller for the gantry crane
__enter__()
Enter the runtime context of the gantry controller.
Returns: |
|
---|
__exit__(exc_type, exc_value, traceback)
Exit the runtime context and clean up resources
Parameters: |
|
---|
__init__(properties_file)
Initialize a GantryController instance
Parameters: |
|
---|
connectToCrane()
abstractmethod
Method to connect to the gantry crane.
This method must be implemented by subclasses to define how to connect to a specific gantry crane.
executeTrajectory(traj)
abstractmethod
Execute a trajectory
This methods must be implemented by subclasses to define how the trajectory is executed.
Parameters: |
|
---|
generateTrajectory(start, stop, genmethod='ocp')
Generate a trajectory using the trajectory generator
Parameters: |
|
---|
Returns: |
|
---|
hoist(pos)
abstractmethod
Perform a hoisting movement
Must be implemented by subclasses.
Parameters: |
|
---|
moveTrajectoryWithoutLog(traj)
Move according to the given trajectory
Parameters: |
|
---|
Returns: |
|
---|
moveWithLog(target, generator='ocp')
Make a movement and log it to a database
Parameters: |
|
---|
Returns: |
|
---|
moveWithoutLog(target, generator='ocp')
Make a movement but don't log it to the database
Parameters: |
|
---|
Returns: |
|
---|
simpleMove(target)
abstractmethod
Perform a simple lateral move without trajectory generation
Must be implemented by subclasses.
Parameters: |
|
---|
storeMeasurement(measurement)
Store a measurement in the database
measurement is assumed to be a tuple as returned by executeTrajectory format: (ts, x, v, a, theta, omega) ts : timestamps [datetime format] x : position [m] v : velocity [m/s] a : acceleration [m/s2] theta : angular position [rad] omega : angular velocity [rad/s]
Parameters: |
|
---|
storeTrajectory(traj)
Store a trajectory in the database
traj is assumed to be tuple as returned by generateTrajectory format: (ts, xs, dxs, ddxs, thetas, dthetas, ddthetas) ts : sample times of solution [s] xs : positions of solution [m] dxs : velocity of solution [m/s] ddxs : acceleration of solution [m/s^2] thetas : angular position of solution [rad] dthetas : angular velocity of solution [rad/s] ddthetas: angular acceleration of solution [rad/s^2] us : input force acting on cart [N]
Parameters: |
|
---|