-
Notifications
You must be signed in to change notification settings - Fork 0
Module drivers core
Stefan deBruyn edited this page Oct 26, 2018
·
12 revisions
| Slack | Github | |
|---|---|---|
| Stefan | @stefandebruyn | @stefandebruyn |
| Tianshu | @thetianshuhuang | @thetianshuhuang |
Contains the lowest-level robot class.
-
RobotFrame- A threaded encapsulation of subsystem states and an instruction sequence associated with them. Implementations should overrideloop
core.robotcore contains abstract representations of robot subsystems intended to provide a common interface for both simulated and actual robots.
-
Subsystem- Parent of all subsystems. Holds a unique name by which to identify the system -
Motor- Parent of all motor types. Holds arobotmotion.MotionStateand the timestamp of the last update -
StepperMotor- Type ofMotorthat can be updated with a positionxand a timestampt. Velocity, acceleration, and jerk are then calculated by approximating the slopes ofdx/dt,d2x/dt2, andd3x/dt3. -
BinaryActuator- An actuator with a binary state, such as a servo claw -
AnalogActuator- An actuator with a bounded state, such as a linear slide
core.robotmotion contains things relating to motion planning and profiling. Like robotcore, this module is built to be common ground for the simulator and the robot.
-
MotionProfile- Represents a motion profile fitted to someMotionConstraintsand a pair ofMotionStates. Target states at specific points in time within the profile can be fetched withstate_at(float) -
MotionConstraints- The maximum velocity, acceleration, and jerk magnitudes allowed for a particular profile -
MotionState- An instantaneous kinematic state in 1D space;<pos, vel, accel, jerk, time>
Contains the actual motion profile generation algorithms.
-
make_trap- Generates a trapezoidal (three-segment, acceleration-limited) profile -
make_scurve- Generates an S-curve (seven-segment, jerk-limited) profile
The profiling algorithms have some drawbacks. See the notes at the top of drivers/core/profiling.py.
An overly verbose example of using a motion profile:
from core.robotmotion import MotionState, MotionConstraints
from core.profiling import make_scurve
initial_position = 0
initial_velocity = 0
final_position = 100
final_velocity = 0
max_velocity = 10
max_acceleration = 5
max_jerk = 5
profile = make_scurve(MotionState(initial_position, initial_velocity),
MotionState(final_position, final_velocity),
MotionConstraints(max_velocity, max_acceleration, max_jerk))
middle_state = profile.state_at(profile.duration / 2)
with middle_state as s:
middle_pos, middle_vel, middle_accel, middle_jerk = s.x, s.v, s.a, s.j