Documentation
¶
Index ¶
- Variables
- func AddUser(w http.ResponseWriter, r *http.Request)
- func GenerateToken() string
- func GetPosture(w http.ResponseWriter, r *http.Request)
- func GetState(w http.ResponseWriter, r *http.Request)
- func GetUser(w http.ResponseWriter, r *http.Request)
- func Logger(inner http.Handler, name string) http.Handler
- func NewRouter(hmc chan HandlerMessage) *mux.Router
- func PutBase(w http.ResponseWriter, r *http.Request)
- func PutElbow(w http.ResponseWriter, r *http.Request)
- func PutGripper(w http.ResponseWriter, r *http.Request)
- func PutPosture(w http.ResponseWriter, r *http.Request)
- func PutReset(w http.ResponseWriter, r *http.Request)
- func PutShoulder(w http.ResponseWriter, r *http.Request)
- func PutWristAngle(w http.ResponseWriter, r *http.Request)
- func PutWristRotation(w http.ResponseWriter, r *http.Request)
- func RemoveUser(w http.ResponseWriter, r *http.Request)
- type HandlerMessage
- type HandlerMessageType
- type JointInfo
- type PostureCommand
- type RobotCommand
- type RobotPose
- type Route
- type Routes
- type Token
- type User
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
var APIBaseURL = "/leubot/v1.2"
APIBaseURL is the path to the API
var APIHost = "api.interactions.ics.unisg.ch"
APIHost is the hostname
var APIProto = "https://"
APIProto for API access protocol
var HandlerChannel chan HandlerMessage
HandlerChannel is used to communicate between the router and other application logic
Functions ¶
func GetPosture ¶ added in v1.2.2
func GetPosture(w http.ResponseWriter, r *http.Request)
GetPosture gets the current posture
func GetState ¶ added in v1.2.2
func GetState(w http.ResponseWriter, r *http.Request)
GetState gets the current value for each joint
func NewRouter ¶
func NewRouter(hmc chan HandlerMessage) *mux.Router
NewRouter creats a new instance of Router
func PutElbow ¶
func PutElbow(w http.ResponseWriter, r *http.Request)
PutElbow processes the request for Elbow
func PutGripper ¶
func PutGripper(w http.ResponseWriter, r *http.Request)
PutGripper processes the request for Gripper
func PutPosture ¶ added in v1.1.1
func PutPosture(w http.ResponseWriter, r *http.Request)
PutPosture sets all the joints at once
func PutReset ¶
func PutReset(w http.ResponseWriter, r *http.Request)
PutReset processes the request to reset
func PutShoulder ¶
func PutShoulder(w http.ResponseWriter, r *http.Request)
PutShoulder processes the request for Shoulder
func PutWristAngle ¶
func PutWristAngle(w http.ResponseWriter, r *http.Request)
PutWristAngle processes the request for WristAngle
func PutWristRotation ¶
func PutWristRotation(w http.ResponseWriter, r *http.Request)
PutWristRotation processes the request for WristRotation
func RemoveUser ¶
func RemoveUser(w http.ResponseWriter, r *http.Request)
Types ¶
type HandlerMessage ¶
type HandlerMessage struct {
Type HandlerMessageType
Value []interface{}
}
HandlerMessage contains the payload for the command messages
type HandlerMessageType ¶
type HandlerMessageType int
HandlerMessageType is the type for HandlerMessage
const ( // TypeAddUser is to add a user TypeAddUser HandlerMessageType = iota // TypeUserAdded says the user is added TypeUserAdded // TypeUserExisted says a user already exists TypeUserExisted // TypeInvalidUserInfo says something wrong about the user to be added TypeInvalidUserInfo // TypeDeleteUser is to delete a user TypeDeleteUser // TypeUserDeleted says the user is deleted TypeUserDeleted // TypeUserNotFound says no such user exists TypeUserNotFound // TypeGetUser is to get the current user TypeGetUser // TypeCurrentUser has the current user info TypeCurrentUser // TypeGetBase is to get Base TypeGetBase // TypeGetShoulder is to get Shoulder TypeGetShoulder // TypeGetElbow is to get Elbow TypeGetElbow // TypeGetWristAngle is to get WristAngle TypeGetWristAngle // TypeGetWristRotation is to get WristRotation TypeGetWristRotation // TypeGetGripper is to get Gripper TypeGetGripper // TypeGetPosture is to get a posture TypeGetPosture // TypeCurrentBase returns Base TypeCurrentBase // TypeCurrentShoulder returns Shoulder TypeCurrentShoulder // TypeCurrentElbow returns Elbow TypeCurrentElbow // TypeCurrentWristAngle returns WristAngle TypeCurrentWristAngle // TypeCurrentWristRotation returns WristRotation TypeCurrentWristRotation // TypeCurrentGripper returns Gripper TypeCurrentGripper // TypeCurrentPosture returns Posture TypeCurrentPosture // TypePutBase is to change Base TypePutBase // TypePutShoulder is to change Shoulder TypePutShoulder // TypePutElbow is to change Elbow TypePutElbow // TypePutWristAngle is to change WristAngle TypePutWristAngle // TypePutWristRotation is to change WristRotation TypePutWristRotation // TypePutGripper is to change Gripper TypePutGripper // TypePutPosture is to set a posture TypePutPosture // TypePutReset is to reset Leubot TypePutReset // TypeActionPerformed says the action was performed TypeActionPerformed // TypeInvalidToken says something is wrong with Token TypeInvalidToken // TypeInvalidCommand says no such command TypeInvalidCommand // TypeSomethingWentWrong says it didn't go well TypeSomethingWentWrong )
type PostureCommand ¶ added in v1.1.1
type PostureCommand struct {
Token string `json:"token"`
Base uint16 `json:"base"`
Shoulder uint16 `json:"shoulder"`
Elbow uint16 `json:"elbow"`
WristAngle uint16 `json:"wristAngle"`
WristRotation uint16 `json:"wristRotation"`
Gripper uint16 `json:"gripper"`
Delta uint8 `json:"delta"`
}
PostureCommand is a struct for a posture
type RobotCommand ¶
RobotCommand is a struct for each command
type RobotPose ¶ added in v1.2.2
type RobotPose struct {
Base uint16
Shoulder uint16
Elbow uint16
WristAngle uint16
WristRotation uint16
Gripper uint16
}
RobotPose stores the rotations of each joint
func (*RobotPose) BuildArmLinkPacket ¶ added in v1.2.2
func (rp *RobotPose) BuildArmLinkPacket(delta uint8) *armlink.ArmLinkPacket
BuildArmLinkPacket creates a new ArmLinkPacket
type Route ¶
type Route struct {
Name string
Method string
Pattern string
HandlerFunc http.HandlerFunc
}
Route is a basic pattern of the rounting