Documentation ¶
Overview ¶
Package motion provides an HTTP interface to motion controllers
Index ¶
- func GetEnabled(e Enabler) http.HandlerFunc
- func GetInPosition(i InPositionQueryer) http.HandlerFunc
- func GetPos(m Mover) http.HandlerFunc
- func GetSynchronous(s SynchronizationController) http.HandlerFunc
- func GetVelocity(s Speeder) http.HandlerFunc
- func HTTPEnable(iface Enabler, table generichttp.RouteTable)
- func HTTPHomeQuery(iface HomeQuerier, table generichttp.RouteTable)
- func HTTPInPosition(iface InPositionQueryer, table generichttp.RouteTable)
- func HTTPInitialize(i Initializer, table generichttp.RouteTable)
- func HTTPMove(iface Mover, table generichttp.RouteTable)
- func HTTPSpeed(iface Speeder, table generichttp.RouteTable)
- func HTTPStop(iface Stopper, table generichttp.RouteTable)
- func HTTPSync(iface SynchronizationController, table generichttp.RouteTable)
- func Home(m Mover) http.HandlerFunc
- func Homed(e HomeQuerier) http.HandlerFunc
- func Initialize(i Initializer) http.HandlerFunc
- func Limits(l LimitMiddleware) http.HandlerFunc
- func SetEnabled(e Enabler) http.HandlerFunc
- func SetPos(m Mover) http.HandlerFunc
- func SetSynchronous(s SynchronizationController) http.HandlerFunc
- func SetVelocity(s Speeder) http.HandlerFunc
- func Stop(m Stopper) http.HandlerFunc
- type Controller
- type Enabler
- type HTTPMotionController
- type HomeQuerier
- type InPositionQueryer
- type Initializer
- type LimitMiddleware
- type Mover
- type Speeder
- type Stopper
- type SynchronizationController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEnabled ¶
func GetEnabled(e Enabler) http.HandlerFunc
GetEnabled returns an HTTP handler func from an enabler that returns if the axis is enabled
func GetInPosition ¶
func GetInPosition(i InPositionQueryer) http.HandlerFunc
GetInPosition returns an http.HandlerFunc for i.GetInPosition
func GetPos ¶
func GetPos(m Mover) http.HandlerFunc
GetPos returns an HTTP handler func from a mover that gets the position of an axis
func GetSynchronous ¶
func GetSynchronous(s SynchronizationController) http.HandlerFunc
GetSynchronous returns an http.HandlerFunc for s.GetSynchronous
func GetVelocity ¶
func GetVelocity(s Speeder) http.HandlerFunc
GetVelocity returns an HTTP handler func which gets the velocity setpoint on an axis
func HTTPEnable ¶
func HTTPEnable(iface Enabler, table generichttp.RouteTable)
HTTPEnable adds routes for the enabler to the route table
func HTTPHomeQuery ¶
func HTTPHomeQuery(iface HomeQuerier, table generichttp.RouteTable)
HTTPHomeQuery adds routes for the homequerier to the route tabler
func HTTPInPosition ¶
func HTTPInPosition(iface InPositionQueryer, table generichttp.RouteTable)
HTTPInPosition adds routes for InPosition to the route table
func HTTPInitialize ¶
func HTTPInitialize(i Initializer, table generichttp.RouteTable)
HTTPInitialize adds routes for initialization to the route table
func HTTPMove ¶
func HTTPMove(iface Mover, table generichttp.RouteTable)
HTTPMove adds routes for the mover to the route tabler
func HTTPSpeed ¶
func HTTPSpeed(iface Speeder, table generichttp.RouteTable)
HTTPSpeed adds routes for the speeder to the route table
func HTTPStop ¶
func HTTPStop(iface Stopper, table generichttp.RouteTable)
HTTPStop adds routes for the mover to the route tabler
func HTTPSync ¶
func HTTPSync(iface SynchronizationController, table generichttp.RouteTable)
HTTPInitialize adds routes for synchronization to the route table
func Home ¶
func Home(m Mover) http.HandlerFunc
Home returns an HTTP handler func from a mover that homes an axis
func Homed ¶
func Homed(e HomeQuerier) http.HandlerFunc
Homed returns an HTTP handler func from a homer that returns if the axis is homed
func Initialize ¶
func Initialize(i Initializer) http.HandlerFunc
Initialize returns an HTTP handler func that calls Initialize for an axis
func Limits ¶
func Limits(l LimitMiddleware) http.HandlerFunc
Limits returns an HTTP handler func that returns the limits for an axis
func SetEnabled ¶
func SetEnabled(e Enabler) http.HandlerFunc
SetEnabled returns an HTTP handler func from an enabler that enables or disables the axis
func SetPos ¶
func SetPos(m Mover) http.HandlerFunc
SetPos returns an HTTP handler func from a mover that triggers an absolute or relative move on an axis based on the relative query parameter
func SetSynchronous ¶
func SetSynchronous(s SynchronizationController) http.HandlerFunc
SetSynchronous returns an http.HandlerFunc for s.SetSynchronous
func SetVelocity ¶
func SetVelocity(s Speeder) http.HandlerFunc
SetVelocity returns an HTTP handler func which sets the velocity setpoint on an axis
func Stop ¶
func Stop(m Stopper) http.HandlerFunc
Home returns an HTTP handler func from a mover that homes an axis
Types ¶
type Controller ¶
type Controller interface { // Mover - all Controllers must be Movers Mover }
Controller is used for the HTTP interface, which will check if the concrete type satisfies the other interfaces in this package and inject their routes automaticlaly
type Enabler ¶
type Enabler interface { // Enable enables an axis Enable(string) error // Disable disables an axis Disable(string) error // GetEnabled gets if an axis is enabled GetEnabled(string) (bool, error) }
Enabler describes an interface with enable/disable methods for axes
type HTTPMotionController ¶
type HTTPMotionController struct { Controller RouteTable generichttp.RouteTable }
HTTPMotionController wraps a motion controller with HTTP
func NewHTTPMotionController ¶
func NewHTTPMotionController(c Controller) HTTPMotionController
NewHTTPMotionController returns a new HTTP wrapper with the route table pre-configured
func (HTTPMotionController) RT ¶
func (h HTTPMotionController) RT() generichttp.RouteTable
RT satisfies the HTTPer interface
type HomeQuerier ¶
type InPositionQueryer ¶
type InPositionQueryer interface { // GetInPosition returns True if the axis is in position GetInPosition(string) (bool, error) }
InpositionQueryer is a type which can query whether an axis is in position
type Initializer ¶
type Initializer interface { // Initialize an axis, engaging the control electronic controls Initialize(string) error }
Initializer is a type which may initialize an axis
type LimitMiddleware ¶
type LimitMiddleware struct { // Limits contains the server imposed limits on the controller Limits map[string]util.Limiter // Mov is a reference to the mover, used to query axis positions Mov Mover }
LimitMiddleware is a type that can impose axis-specific limits on motion it returns a boolean "notOK" that indicates if the limit would be violated by a motion, stopping the chain of handling calls
func (*LimitMiddleware) Check ¶
func (l *LimitMiddleware) Check(next http.Handler) http.Handler
Check verifies if a motion would violate the axis limit, if it exists, and if it does, responds with StatusBadRequest otherwise, flows control to the next handler
func (LimitMiddleware) Inject ¶
func (l LimitMiddleware) Inject(h generichttp.HTTPer)
Inject places a /axis/{axis}/limits route on the table of the HTTPer
type Mover ¶
type Mover interface { // GetPos gets the current position of an axis GetPos(string) (float64, error) // MoveAbs moves an axis to an absolute position MoveAbs(string, float64) error // MoveRel moves an axis a relative amount MoveRel(string, float64) error // Home homes an axis Home(string) error }
Mover describes an interface with position-related methods for axes
type Speeder ¶
type Speeder interface { // SetVelocity sets the velocity setpoint on the axis SetVelocity(string, float64) error // GetVelocity gets the velocity setpoint on the axis GetVelocity(string) (float64, error) }
Speeder describes an interface with velocity-related methods for axes
type SynchronizationController ¶
type SynchronizationController interface { // SetSynchronous places axis (string) in sync mode SetSynchronous(string, bool) error // GetSynchronous queries whether axis (string) is in sync mode GetSynchronous(string) (bool, error) }
SynchronizationController is a type which can control whether an axis is in synchronous mode or not