Merge branch 'master' of git.elab.kth.se:marek/Twitch-grabs-candy

master
Davide Bongiovanni 6 years ago
commit 071236bc0e

@ -0,0 +1,48 @@
import threading
import DobotDllType as dType
CON_STR = {
dType.DobotConnect.DobotConnect_NoError: "DobotConnect_NoError",
dType.DobotConnect.DobotConnect_NotFound: "DobotConnect_NotFound",
dType.DobotConnect.DobotConnect_Occupied: "DobotConnect_Occupied"}
#Load Dll
api = dType.load()
#Connect Dobot
state = dType.ConnectDobot(api, "", 115200)[0]
print("Connect status:",CON_STR[state])
if (state == dType.DobotConnect.DobotConnect_NoError):
#Clean Command Queued
dType.SetQueuedCmdClear(api)
#Async Motion Params Setting
dType.SetHOMEParams(api, 250, 0, 50, 0, isQueued = 1)
dType.SetPTPJointParams(api, 200, 200, 200, 200, 200, 200, 200, 200, isQueued = 1)
dType.SetPTPCommonParams(api, 100, 100, isQueued = 1)
#Async Home
dType.SetHOMECmd(api, temp = 0, isQueued = 1)
#Async PTP Motion
for i in range(0, 5):
if i % 2 == 0:
offset = 50
else:
offset = -50
lastIndex = dType.SetPTPCmd(api, dType.PTPMode.PTPMOVLXYZMode, 200 + offset, offset, offset, offset, isQueued = 1)[0]
#Start to Execute Command Queued
dType.SetQueuedCmdStartExec(api)
#Wait for Executing Last Command
while lastIndex > dType.GetQueuedCmdCurrentIndex(api)[0]:
dType.dSleep(100)
#Stop to Execute Command Queued
dType.SetQueuedCmdStopExec(api)
#Disconnect Dobot
dType.DisconnectDobot(api)

Binary file not shown.

Binary file not shown.

@ -0,0 +1,221 @@
#ifndef DOBOTDLL_H
#define DOBOTDLL_H
#include "dobotdll_global.h"
#include "DobotType.h"
extern "C" DOBOTDLLSHARED_EXPORT int DobotExec(void);
extern "C" DOBOTDLLSHARED_EXPORT int SearchDobot(char *dobotNameList, uint32_t maxLen);
extern "C" DOBOTDLLSHARED_EXPORT int ConnectDobot(const char *portName, uint32_t baudrate, char *fwType, char *version);
extern "C" DOBOTDLLSHARED_EXPORT int DisconnectDobot(void);
extern "C" DOBOTDLLSHARED_EXPORT int SetCmdTimeout(uint32_t cmdTimeout);
// Device information
extern "C" DOBOTDLLSHARED_EXPORT int SetDeviceSN(const char *deviceSN);
extern "C" DOBOTDLLSHARED_EXPORT int GetDeviceSN(char *deviceSN, uint32_t maxLen);
extern "C" DOBOTDLLSHARED_EXPORT int SetDeviceName(const char *deviceName);
extern "C" DOBOTDLLSHARED_EXPORT int GetDeviceName(char *deviceName, uint32_t maxLen);
extern "C" DOBOTDLLSHARED_EXPORT int GetDeviceVersion(uint8_t *majorVersion, uint8_t *minorVersion, uint8_t *revision);
extern "C" DOBOTDLLSHARED_EXPORT int SetDeviceWithL(bool isWithL, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetDeviceWithL(bool *isWithL);
extern "C" DOBOTDLLSHARED_EXPORT int GetDeviceTime(uint32_t *deviceTime);
// Pose and Kinematics parameters are automatically get
extern "C" DOBOTDLLSHARED_EXPORT int GetPose(Pose *pose);
extern "C" DOBOTDLLSHARED_EXPORT int ResetPose(bool manual, float rearArmAngle, float frontArmAngle);
extern "C" DOBOTDLLSHARED_EXPORT int GetKinematics(Kinematics *kinematics);
extern "C" DOBOTDLLSHARED_EXPORT int GetPoseL(float *l);
// Alarms
extern "C" DOBOTDLLSHARED_EXPORT int GetAlarmsState(uint8_t *alarmsState, uint32_t *len, uint32_t maxLen);
extern "C" DOBOTDLLSHARED_EXPORT int ClearAllAlarmsState(void);
// HOME
extern "C" DOBOTDLLSHARED_EXPORT int SetHOMEParams(HOMEParams *homeParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetHOMEParams(HOMEParams *homeParams);
extern "C" DOBOTDLLSHARED_EXPORT int SetHOMECmd(HOMECmd *homeCmd, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int SetAutoLevelingCmd(AutoLevelingCmd *autoLevelingCmd, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetAutoLevelingResult(float *precision);
// Handheld teach
extern "C" DOBOTDLLSHARED_EXPORT int SetHHTTrigMode(HHTTrigMode hhtTrigMode);
extern "C" DOBOTDLLSHARED_EXPORT int GetHHTTrigMode(HHTTrigMode *hhtTrigMode);
extern "C" DOBOTDLLSHARED_EXPORT int SetHHTTrigOutputEnabled(bool isEnabled);
extern "C" DOBOTDLLSHARED_EXPORT int GetHHTTrigOutputEnabled(bool *isEnabled);
extern "C" DOBOTDLLSHARED_EXPORT int GetHHTTrigOutput(bool *isTriggered);
// EndEffector
extern "C" DOBOTDLLSHARED_EXPORT int SetEndEffectorParams(EndEffectorParams *endEffectorParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetEndEffectorParams(EndEffectorParams *endEffectorParams);
extern "C" DOBOTDLLSHARED_EXPORT int SetEndEffectorLaser(bool enableCtrl, bool on, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetEndEffectorLaser(bool *isCtrlEnabled, bool *isOn);
extern "C" DOBOTDLLSHARED_EXPORT int SetEndEffectorSuctionCup(bool enableCtrl, bool suck, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetEndEffectorSuctionCup(bool *isCtrlEnabled, bool *isSucked);
extern "C" DOBOTDLLSHARED_EXPORT int SetEndEffectorGripper(bool enableCtrl, bool grip, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetEndEffectorGripper(bool *isCtrlEnabled, bool *isGripped);
// Arm orientation
extern "C" DOBOTDLLSHARED_EXPORT int SetArmOrientation(ArmOrientation armOrientation, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetArmOrientation(ArmOrientation *armOrientation);
// JOG functions
extern "C" DOBOTDLLSHARED_EXPORT int SetJOGJointParams(JOGJointParams *jointJogParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetJOGJointParams(JOGJointParams *jointJogParams);
extern "C" DOBOTDLLSHARED_EXPORT int SetJOGCoordinateParams(JOGCoordinateParams *coordinateJogParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetJOGCoordinateParams(JOGCoordinateParams *coordinateJogParams);
extern "C" DOBOTDLLSHARED_EXPORT int SetJOGLParams(JOGLParams *jogLParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetJOGLParams(JOGLParams *jogLParams);
extern "C" DOBOTDLLSHARED_EXPORT int SetJOGCommonParams(JOGCommonParams *jogCommonParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetJOGCommonParams(JOGCommonParams *jogCommonParams);
extern "C" DOBOTDLLSHARED_EXPORT int SetJOGCmd(JOGCmd *jogCmd, bool isQueued, uint64_t *queuedCmdIndex);
// PTP functions
extern "C" DOBOTDLLSHARED_EXPORT int SetPTPJointParams(PTPJointParams *ptpJointParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetPTPJointParams(PTPJointParams *ptpJointParams);
extern "C" DOBOTDLLSHARED_EXPORT int SetPTPCoordinateParams(PTPCoordinateParams *ptpCoordinateParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetPTPCoordinateParams(PTPCoordinateParams *ptpCoordinateParams);
extern "C" DOBOTDLLSHARED_EXPORT int SetPTPLParams(PTPLParams *ptpLParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetPTPLParams(PTPLParams *ptpLParams);
extern "C" DOBOTDLLSHARED_EXPORT int SetPTPJumpParams(PTPJumpParams *ptpJumpParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetPTPJumpParams(PTPJumpParams *ptpJumpParams);
extern "C" DOBOTDLLSHARED_EXPORT int SetPTPCommonParams(PTPCommonParams *ptpCommonParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetPTPCommonParams(PTPCommonParams *ptpCommonParams);
extern "C" DOBOTDLLSHARED_EXPORT int SetPTPCmd(PTPCmd *ptpCmd, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int SetPTPWithLCmd(PTPWithLCmd *ptpWithLCmd, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int SetPTPJump2Params(PTPJump2Params *ptpJump2Params, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetPTPJump2Params(PTPJump2Params *ptpJump2Params);
extern "C" DOBOTDLLSHARED_EXPORT int SetPTPPOCmd(PTPCmd *ptpCmd, ParallelOutputCmd *parallelCmd, int parallelCmdCount, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int SetPTPPOWithLCmd(PTPWithLCmd *ptpWithLCmd, ParallelOutputCmd *parallelCmd, int parallelCmdCount, bool isQueued, uint64_t *queuedCmdIndex);
// CP functions
extern "C" DOBOTDLLSHARED_EXPORT int SetCPParams(CPParams *cpParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetCPParams(CPParams *cpParams);
extern "C" DOBOTDLLSHARED_EXPORT int SetCPCmd(CPCmd *cpCmd, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int SetCPLECmd(CPCmd *cpCmd, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int SetCPRHoldEnable(bool isEnable);
extern "C" DOBOTDLLSHARED_EXPORT int GetCPRHoldEnable(bool *isEnable);
extern "C" DOBOTDLLSHARED_EXPORT int SetCPCommonParams(CPCommonParams *cpCommonParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetCPCommonParams(CPCommonParams *cpCommonParams);
// ARC
extern "C" DOBOTDLLSHARED_EXPORT int SetARCParams(ARCParams *arcParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetARCParams(ARCParams *arcParams);
extern "C" DOBOTDLLSHARED_EXPORT int SetARCCmd(ARCCmd *arcCmd, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int SetCircleCmd(CircleCmd *circleCmd, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int SetARCCommonParams(ARCCommonParams *arcCommonParams, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetARCCommonParams(ARCCommonParams *arcCommonParams);
// WAIT
extern "C" DOBOTDLLSHARED_EXPORT int SetWAITCmd(WAITCmd *waitCmd, bool isQueued, uint64_t *queuedCmdIndex);
// TRIG
extern "C" DOBOTDLLSHARED_EXPORT int SetTRIGCmd(TRIGCmd *trigCmd, bool isQueued, uint64_t *queuedCmdIndex);
// EIO
extern "C" DOBOTDLLSHARED_EXPORT int SetIOMultiplexing(IOMultiplexing *ioMultiplexing, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetIOMultiplexing(IOMultiplexing *ioMultiplexing);
extern "C" DOBOTDLLSHARED_EXPORT int SetIODO(IODO *ioDO, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetIODO(IODO *ioDO);
extern "C" DOBOTDLLSHARED_EXPORT int SetIOPWM(IOPWM *ioPWM, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetIOPWM(IOPWM *ioPWM);
extern "C" DOBOTDLLSHARED_EXPORT int GetIODI(IODI *ioDI);
extern "C" DOBOTDLLSHARED_EXPORT int GetIOADC(IOADC *ioADC);
extern "C" DOBOTDLLSHARED_EXPORT int SetEMotor(EMotor *eMotor, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int SetEMotorS(EMotorS *eMotorS, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int SetColorSensor(bool enable,ColorPort colorPort);
extern "C" DOBOTDLLSHARED_EXPORT int GetColorSensor(uint8_t *r, uint8_t *g, uint8_t *b);
extern "C" DOBOTDLLSHARED_EXPORT int SetInfraredSensor(bool enable,InfraredPort infraredPort);
extern "C" DOBOTDLLSHARED_EXPORT int GetInfraredSensor(InfraredPort port, uint8_t *value);
// CAL
extern "C" DOBOTDLLSHARED_EXPORT int SetAngleSensorStaticError(float rearArmAngleError, float frontArmAngleError);
extern "C" DOBOTDLLSHARED_EXPORT int GetAngleSensorStaticError(float *rearArmAngleError, float *frontArmAngleError);
extern "C" DOBOTDLLSHARED_EXPORT int SetAngleSensorCoef(float rearArmAngleCoef, float frontArmAngleCoef);
extern "C" DOBOTDLLSHARED_EXPORT int GetAngleSensorCoef(float *rearArmAngleCoef, float *frontArmAngleCoef);
extern "C" DOBOTDLLSHARED_EXPORT int SetBaseDecoderStaticError(float baseDecoderError);
extern "C" DOBOTDLLSHARED_EXPORT int GetBaseDecoderStaticError(float *baseDecoderError);
extern "C" DOBOTDLLSHARED_EXPORT int SetLRHandCalibrateValue(float lrHandCalibrateValue);
extern "C" DOBOTDLLSHARED_EXPORT int GetLRHandCalibrateValue(float *lrHandCalibrateValue);
// WIFI
extern "C" DOBOTDLLSHARED_EXPORT int SetWIFIConfigMode(bool enable);
extern "C" DOBOTDLLSHARED_EXPORT int GetWIFIConfigMode(bool *isEnabled);
extern "C" DOBOTDLLSHARED_EXPORT int SetWIFISSID(const char *ssid);
extern "C" DOBOTDLLSHARED_EXPORT int GetWIFISSID(char *ssid, uint32_t maxLen);
extern "C" DOBOTDLLSHARED_EXPORT int SetWIFIPassword(const char *password);
extern "C" DOBOTDLLSHARED_EXPORT int GetWIFIPassword(char *password, uint32_t maxLen);
extern "C" DOBOTDLLSHARED_EXPORT int SetWIFIIPAddress(WIFIIPAddress *wifiIPAddress);
extern "C" DOBOTDLLSHARED_EXPORT int GetWIFIIPAddress(WIFIIPAddress *wifiIPAddress);
extern "C" DOBOTDLLSHARED_EXPORT int SetWIFINetmask(WIFINetmask *wifiNetmask);
extern "C" DOBOTDLLSHARED_EXPORT int GetWIFINetmask(WIFINetmask *wifiNetmask);
extern "C" DOBOTDLLSHARED_EXPORT int SetWIFIGateway(WIFIGateway *wifiGateway);
extern "C" DOBOTDLLSHARED_EXPORT int GetWIFIGateway(WIFIGateway *wifiGateway);
extern "C" DOBOTDLLSHARED_EXPORT int SetWIFIDNS(WIFIDNS *wifiDNS);
extern "C" DOBOTDLLSHARED_EXPORT int GetWIFIDNS(WIFIDNS *wifiDNS);
extern "C" DOBOTDLLSHARED_EXPORT int GetWIFIConnectStatus(bool *isConnected);
//FIRMWARE
extern "C" DOBOTDLLSHARED_EXPORT int UpdateFirmware(FirmwareParams *firmwareParams);
extern "C" DOBOTDLLSHARED_EXPORT int SetFirmwareMode(FirmwareMode *firmwareMode);
extern "C" DOBOTDLLSHARED_EXPORT int GetFirmwareMode(FirmwareMode *firmwareMode);
//LOSTSTEP
extern "C" DOBOTDLLSHARED_EXPORT int SetLostStepParams(float threshold, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int SetLostStepCmd(bool isQueued, uint64_t *queuedCmdIndex);
//UART4 Peripherals
extern "C" DOBOTDLLSHARED_EXPORT int GetUART4PeripheralsType(uint8_t *type);
extern "C" DOBOTDLLSHARED_EXPORT int SetUART4PeripheralsEnable(bool isEnable);
extern "C" DOBOTDLLSHARED_EXPORT int GetUART4PeripheralsEnable(bool *isEnable);
//Function Pluse Mode
extern "C" DOBOTDLLSHARED_EXPORT int SendPluse(PluseCmd *pluseCmd, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int SendPluseEx(PluseCmd *pluseCmd);
// TEST
extern "C" DOBOTDLLSHARED_EXPORT int GetUserParams(UserParams *userParams);
extern "C" DOBOTDLLSHARED_EXPORT int GetPTPTime(PTPCmd *ptpCmd, uint32_t *ptpTime);
extern "C" DOBOTDLLSHARED_EXPORT int GetServoPIDParams(PID *pid);
extern "C" DOBOTDLLSHARED_EXPORT int SetServoPIDParams(PID *pid, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int GetServoControlLoop(uint8_t index, uint8_t *controlLoop);
extern "C" DOBOTDLLSHARED_EXPORT int SetServoControlLoop(uint8_t index, uint8_t controlLoop, bool isQueued, uint64_t *queuedCmdIndex);
extern "C" DOBOTDLLSHARED_EXPORT int SaveServoPIDParams(uint8_t index, uint8_t controlLoop, bool isQueued, uint64_t *queuedCmdIndex);
// Queued command
extern "C" DOBOTDLLSHARED_EXPORT int SetQueuedCmdStartExec(void);
extern "C" DOBOTDLLSHARED_EXPORT int SetQueuedCmdStopExec(void);
extern "C" DOBOTDLLSHARED_EXPORT int SetQueuedCmdForceStopExec(void);
extern "C" DOBOTDLLSHARED_EXPORT int SetQueuedCmdStartDownload(uint32_t totalLoop, uint32_t linePerLoop);
extern "C" DOBOTDLLSHARED_EXPORT int SetQueuedCmdStopDownload(void);
extern "C" DOBOTDLLSHARED_EXPORT int SetQueuedCmdClear(void);
extern "C" DOBOTDLLSHARED_EXPORT int GetQueuedCmdCurrentIndex(uint64_t *queuedCmdCurrentIndex);
#endif // DOBOTDLL_H

Binary file not shown.

File diff suppressed because it is too large Load Diff

@ -0,0 +1,488 @@
#ifndef DOBOTTYPE_H
#define DOBOTTYPE_H
#ifdef _MSC_VER
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned int uint32_t;
typedef signed int int32_t;
typedef unsigned long long uint64_t;
typedef signed long long int64_t;
#else
#include <stdint.h>
#endif
/*********************************************************************************************************
** Data structures
*********************************************************************************************************/
/*********************************************************************************************************
** Common parts
*********************************************************************************************************/
#pragma pack(push)
#pragma pack(1)
/*
* Real-time pose
*/
typedef struct tagPose {
float x;
float y;
float z;
float r;
float jointAngle[4];
}Pose;
/*
* Kinematics parameters
*/
typedef struct tagKinematics {
float velocity;
float acceleration;
}Kinematics;
/*
* HOME related
*/
typedef struct tagHOMEParams {
float x;
float y;
float z;
float r;
}HOMEParams;
typedef struct tagHOMECmd {
uint32_t reserved;
}HOMECmd;
typedef struct tagAutoLevelingCmd {
uint8_t controlFlag;
float precision;
}AutoLevelingCmd;
/*
* Hand hold teach
*/
typedef enum tagHHTTrigMode {
TriggeredOnKeyReleased,
TriggeredOnPeriodicInterval
}HHTTrigMode;
/*
* End effector
*/
typedef struct tagEndEffectorParams {
float xBias;
float yBias;
float zBias;
}EndEffectorParams;
/*
* Arm orientation
*/
typedef enum tagArmOrientation {
LeftyArmOrientation,
RightyArmOrientation,
}ArmOrientation;
/*
* JOG related
*/
typedef struct tagJOGJointParams {
float velocity[4];
float acceleration[4];
}JOGJointParams;
typedef struct tagJOGCoordinateParams {
float velocity[4];
float acceleration[4];
}JOGCoordinateParams;
typedef struct tagJOGLParams {
float velocity;
float acceleration;
}JOGLParams;
typedef struct tagJOGCommonParams {
float velocityRatio;
float accelerationRatio;
}JOGCommonParams;
enum {
JogIdle,
JogAPPressed,
JogANPressed,
JogBPPressed,
JogBNPressed,
JogCPPressed,
JogCNPressed,
JogDPPressed,
JogDNPressed,
JogEPPressed,
JogENPressed
};
typedef struct tagJOGCmd {
uint8_t isJoint;
uint8_t cmd;
}JOGCmd;
/*
* PTP related
*/
typedef struct tagPTPJointParams {
float velocity[4];
float acceleration[4];
}PTPJointParams;
typedef struct tagPTPCoordinateParams {
float xyzVelocity;
float rVelocity;
float xyzAcceleration;
float rAcceleration;
}PTPCoordinateParams;
typedef struct tagPTPLParams {
float velocity;
float acceleration;
}PTPLParams;
typedef struct tagPTPJumpParams {
float jumpHeight;
float zLimit;
}PTPJumpParams;
typedef struct tagPTPJump2Params {
float startJumpHeight;
float endJumpHeight;
float zLimit;
}PTPJump2Params;
typedef struct tagPTPCommonParams {
float velocityRatio;
float accelerationRatio;
}PTPCommonParams;
enum PTPMode {
PTPJUMPXYZMode,
PTPMOVJXYZMode,
PTPMOVLXYZMode,
PTPJUMPANGLEMode,
PTPMOVJANGLEMode,
PTPMOVLANGLEMode,
PTPMOVJANGLEINCMode,
PTPMOVLXYZINCMode,
PTPMOVJXYZINCMode,
PTPJUMPMOVLXYZMode,
};
typedef struct tagPTPCmd {
uint8_t ptpMode;
float x;
float y;
float z;
float r;
}PTPCmd;
typedef struct tagPTPWithLCmd {
uint8_t ptpMode;
float x;
float y;
float z;
float r;
float l;
}PTPWithLCmd;
typedef struct tagParallelOutputCmd {
uint8_t ratio;
uint16_t address;
uint8_t level;
}ParallelOutputCmd;
/*
* CP related
*/
typedef struct tagCPParams
{
float planAcc;
float juncitionVel;
union {
float acc;
float period;
};
uint8_t realTimeTrack;
}CPParams;
typedef struct tagCPCommonParams {
float velocityRatio;
float accelerationRatio;
}CPCommonParams;
enum CPMode {
CPRelativeMode,
CPAbsoluteMode
};
typedef struct tagCPCmd {
uint8_t cpMode;
float x;
float y;
float z;
union {
float velocity;
float power;
};
}CPCmd;
/*
* ARC related
*/
typedef struct tagARCParams {
float xyzVelocity;
float rVelocity;
float xyzAcceleration;
float rAcceleration;
}ARCParams;
typedef struct tagARCCommonParams {
float velocityRatio;
float accelerationRatio;
}ARCCommonParams;
typedef struct tagARCCmd {
struct {
float x;
float y;
float z;
float r;
}cirPoint;
struct {
float x;
float y;
float z;
float r;
}toPoint;
}ARCCmd;
typedef struct tagCircleCmd {
struct {
float x;
float y;
float z;
float r;
}cirPoint;
struct {
float x;
float y;
float z;
float r;
}toPoint;
uint32_t count;
}CircleCmd;
typedef struct tagWAITCmd {
uint32_t timeout;
}WAITCmd;
typedef enum tagTRIGMode {
TRIGInputIOMode,
TRIGADCMode
}TRIGMode;
typedef enum tagTRIGInputIOCondition {
TRIGInputIOEqual,
TRIGInputIONotEqual
}TRIGInputIOCondition;
typedef enum tagTRIGADCCondition {
TRIGADCLT, // Lower than
TRIGADCLE, // Lower than or Equal
TRIGADCGE, // Greater than or Equal
TRIGADCGT // Greater Than
}TRIGADCCondition;
typedef struct tagTRIGCmd {
uint8_t address;
uint8_t mode;
uint8_t condition;
uint16_t threshold;
}TRIGCmd;
typedef enum tagIOFunction {
IOFunctionDummy,
IOFunctionDO,
IOFunctionPWM,
IOFunctionDI,
IOFunctionADC
}IOFunction;
typedef struct tagIOMultiplexing {
uint8_t address;
uint8_t multiplex;
}IOMultiplexing;
typedef struct tagIODO {
uint8_t address;
uint8_t level;
}IODO;
typedef struct tagIOPWM {
uint8_t address;
float frequency;
float dutyCycle;
}IOPWM;
typedef struct tagIODI {
uint8_t address;
uint8_t level;
}IODI;
typedef struct tagIOADC {
uint8_t address;
uint16_t value;
}IOADC;
typedef struct tagEMotor {
uint8_t index;
uint8_t isEnabled;
int32_t speed;
}EMotor;
typedef struct tagEMotorS {
uint8_t index;
uint8_t isEnabled;
int32_t speed;
uint32_t distance;
}EMotorS;
/*
* WIFI related
*/
typedef struct tagWIFIIPAddress {
uint8_t dhcp;
uint8_t addr[4];
}WIFIIPAddress;
typedef struct tagWIFINetmask {
uint8_t addr[4];
}WIFINetmask;
typedef struct tagWIFIGateway {
uint8_t addr[4];
}WIFIGateway;
typedef struct tagWIFIDNS {
uint8_t addr[4];
}WIFIDNS;
/*
* Test
*/
typedef struct tagUserParams{
float params[8];
}UserParams;
/*
* Firmware related
*/
enum FirmwareSwitchMode{
NO_SWITCH,
DOBOT_SWITCH,
PRINTING_SWITCH,
DRIVER1_SWITCH,
DRIVER2_SWITCH,
DRIVER3_SWITCH,
DRIVER4_SWITCH,
DRIVER5_SWITCH
};
typedef struct tagFirmwareParams {
uint8_t mode;
}FirmwareParams;
enum FirewareMode{
INVALID_MODE,
DOBOT_MODE,
PRINTING_MODE,
OFFLINE_MODE
};
typedef struct tagFirmwareModes {
uint8_t mode;
uint8_t ctl; //0 or 1
}FirmwareMode;
typedef enum tagServoControlLoop{
ServoPositionLoop,
ServoVelocityLoop,
ServoCurrentLoop
}ServoControlLoop;
typedef struct tagPIDParams{
float p;
float i;
float d;
float v;
float a;
}PIDParams;
typedef struct tagPID{
uint8_t index;
uint8_t controlLoop;
PIDParams params;
}PID;
typedef enum tagColorPort{
CL_PORT_GP1,
CL_PORT_GP2,
CL_PORT_GP4,
CL_PORT_GP5
}ColorPort;
typedef enum tagInfraredPort{
IF_PORT_GP1,
IF_PORT_GP2,
IF_PORT_GP4,
IF_PORT_GP5
}InfraredPort;
typedef enum tagUART4PeripheralsType {
UART4PeripheralsUART,
UART4PeripheralsWIFI,
UART4PeripheralsBLE,
UART4PeripheralsCH375
} UART4PeripheralsType;
typedef struct tagPluseCmd {
float j1;
float j2;
float j3;
float j4;
float e1;
float e2;
} PluseCmd;
/*********************************************************************************************************
** API result
*********************************************************************************************************/
enum {
DobotConnect_NoError,
DobotConnect_NotFound,
DobotConnect_Occupied
};
enum {
DobotCommunicate_NoError,
DobotCommunicate_BufferFull,
DobotCommunicate_Timeout,
DobotCommunicate_InvalidParams
};
#pragma pack(pop)
#endif

@ -0,0 +1,12 @@
#ifndef DOBOTDLL_GLOBAL_H
#define DOBOTDLL_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(DOBOTDLL_LIBRARY)
# define DOBOTDLLSHARED_EXPORT Q_DECL_EXPORT
#else
# define DOBOTDLLSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // DOBOTDLL_GLOBAL_H

@ -0,0 +1,78 @@
import threading
import time
startTime = time.time()
nowTime = 0;
currentMotor = 0
motorcfg = [0] * 10
motorcfg[1] = {"positive":1, "negative":2, 'speedslot':2}
motorcfg[2] = {"positive":3, "negative":4, 'speedslot':4}
motorcfg[3] = {"positive":5, "negative":6, 'speedslot':6}
friction = 0.99
movement_time = 5
max_movement_time = 10
min_speed = 1
max_speed = 50
speed = 0
stopTime = 0
isRunning = False
def adjustSpeed(motor, adjustment):
global nowTime, stopTime, currentMotor, speed, motorcfg, movement_time, max_speed, max_movement_time
if currentMotor==motor:
speed += adjustment * (abs(speed)/max_speed)
stopTime += movement_time/2 * max_movement_time/(stopTime - nowTime)
else:
currentMotor = motor
speed = adjustment
stopTime = nowTime + movement_time
if(speed>0):
print("JOG command {}".format(motorcfg[currentMotor]['positive']))
else:
print("JOG command {}".format(motorcfg[currentMotor]['negative']))
def stopMotorFunctions():
global currentMotor, speed
currentMotor = 0
speed = 0
print ("JOB command stop all motors")
def updateLoop():
global nowTime, stopTime, currentMotor, speed, friction, min_speed, motorcfg
nowTime = (time.time() - startTime)
threading.Timer(0.2, updateLoop).start()
if currentMotor != 0:
if nowTime > stopTime:
stopMotorFunctions()
return
else:
speed *= friction
if abs(speed) < min_speed:
stopMotorFunctions()
return
print("JOG parameter {} to {}".format( motorcfg[currentMotor]['speedslot'], abs(speed)) )
def rt():
adjustSpeed(1, 5)
def lt():
adjustSpeed(1, -5)
def up():
adjustSpeed(2, 5)
def dn():
adjustSpeed(2, -5)
updateLoop();

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,324 @@
import time
import threading
import DobotDllType as dType
"""
Six actuators:
linear rail
base rotation
rear arm
forarm
gripperrotation
gripper
First five takes argument 1 or -1 (direction)
Example:
#initialisation
c = Candybot()
c.linear(1) # move linear in positive direction
c.gripp() # gripp candy
c.letgo() # let go of candy
c.stopcmp() # stoop compressor
c.panic() # stops everything
"""
class Candybot:
def __init__(self):
self.jointspeed = 100
self.lastjointspeed = 100
self.linearspeed = 100
self.lastleinearspeed = 100
CON_STR = {
dType.DobotConnect.DobotConnect_NoError: "DobotConnect_NoError",
dType.DobotConnect.DobotConnect_NotFound: "DobotConnect_NotFound",
dType.DobotConnect.DobotConnect_Occupied: "DobotConnect_Occupied"}
#Load Dll
self.api = dType.load()
#Connect Dobot
state = dType.ConnectDobot(self.api, "", 115200)[0]
print("Connect status:",CON_STR[state])
if (state == dType.DobotConnect.DobotConnect_NoError):
#Clean Command Queued
dType.SetQueuedCmdClear(self.api)
#Async Motion Params Setting
dType.SetHOMEParams(self.api, 250, 0, 50, 0, isQueued = 1)
dType.SetJOGJointParams(self.api, 2, 200, 2, 200, 2, 200, 2, 200, isQueued = 1)
dType.SetJOGCommonParams(self.api, 100, 100, isQueued = 1)
#linear rail
dType.SetDeviceWithL(self.api, 1)
dType.SetJOGLParams(self.api, 200, 200, isQueued=0)
#Async Home
dType.SetHOMECmd(self.api, temp = 0, isQueued = 1)
def disconnect(self):
#Disconnect Dobot
dType.DisconnectDobot(self.api)
def base(self, direction):
if direction == 1:
dType.SetJOGCmd(self.api,1,1)
elif direction == -1:
dType.SetJOGCmd(self.api,1,2)
else :
return
threading.Timer(0.1,self.stop).start()
#dType.SetWAITCmd(self.api, 1, isQueued=0)
#dType.SetJOGCmd(self.api, 1, 0)
def rearArm(self, direction):
if direction == 1:
dType.SetJOGCmd(self.api,1,3)
elif direction == -1:
dType.SetJOGCmd(self.api,1,4)
else :
return
#dType.SetWAITCmd(self.api, 1, isQueued=0)
#dType.SetJOGCmd(self.api, 1, 0)
threading.Timer(0.1,self.stop).start()
def forearm(self, direction):
if direction == 1:
dType.SetJOGCmd(self.api,1,5)
elif direction == -1:
dType.SetJOGCmd(self.api,1,6)
else :
return
#dType.SetWAITCmd(self.api, 1, isQueued=0)
#dType.SetJOGCmd(self.api, 1, 0)
threading.Timer(0.1,self.stop).start()
def gripperRotation(self, direction):
if direction == 1:
dType.SetJOGCmd(self.api,1,7)
elif direction == -1:
dType.SetJOGCmd(self.api,1,8)
else :
return
#dType.SetWAITCmd(self.api, 1, isQueued=0)
#dType.SetJOGCmd(self.api, 1, 0)
threading.Timer(0.1,self.stop).start()
def linear(self, direction):
if direction == 1:
dType.SetJOGCmd(self.api,1,9)
elif direction == -1:
dType.SetJOGCmd(self.api,1,10)
else :
return
#dType.SetWAITCmd(self.api, 1, isQueued=0)
#dType.SetJOGCmd(self.api, 1, 0)
self.lint = threading.Timer(0.2,self.stop)
self.lint.start()
def gripp(self):
dType.SetEndEffectorGripper(self.api, 1, 1, isQueued=0)
def letgo(self):
dType.SetEndEffectorGripper(self.api, 1, 0, isQueued=0)
def stop(self):
dType.SetJOGCmd(self.api, 1, 0)
def stopcmp(self):
dType.SetEndEffectorGripper(self.api, 0, 0, isQueued=0)
def panic(self):
dType.SetQueuedCmdForceStopExec(self.api)
def getCurrentCmd(self):
return dType.GetQueuedCmdCurrentIndex(self.api)
def JOGtest(self):
dType.SetJOGCmd(self.api,1,1)
dType.SetJOGCmd(self.api,1,9)
def JOGtest2(self):
dType.SetJOGLParams(self.api, 100, 200, isQueued=0)
dType.SetJOGCmd(self.api,1,9)
time.sleep(1)
for speed in range(100,10,-10):
time.sleep(0.3)
dType.SetJOGLParams(self.api, speed, 200, isQueued=0)
def setparams(self, name, speed):
lookup = {'base' : 0, 'reararm' : 1, 'forearm' : 2, 'gripperroation' :3}
if name == 'rail':
dType.SetJOGLParams(self.api, speed, 200, isQueued=0)
else:
speeds = [0,0,0,0]
speeds[lookup[name]] = speed
dType.SetJOGJointParams(self.api, speeds[0], 200, speeds[1], 200, speeds[2], 200, speeds[3], 200, isQueued = 1)
def setJOGcmd(self, cmd):
dType.SetJOGCmd(self.api,1,cmd)
candy = Candybot()
startTime = time.time()
nowTime = 0
currentMotor = 0
motorcfg = [0] * 10
motorcfg[1] = {"name" : 'base' , "positive":1, "negative":2, 'speedslot':2}
motorcfg[2] = {"name" : 'reararm' ,"positive":3, "negative":4, 'speedslot':4}
motorcfg[3] = {"name" : 'forearm' ,"positive":5, "negative":6, 'speedslot':6}
motorcfg[4] = {"name" : 'rail' ,"positive":9, "negative":10, 'speedslot':1}
friction = 0.95
movement_time = 3
max_movement_time = 5
min_speed = 1
max_speed = 50
speed = 0
stopTime = 0
isRunning = False
def adjustSpeed(motor, adjustment):
global nowTime, stopTime, currentMotor, speed, motorcfg, movement_time, max_speed, max_movement_time
if currentMotor==motor:
if (adjustment>0 and speed>0) or (adjustment<0 and speed<0):=
speed += adjustment * 1-(abs(speed)/max_speed)
else:
stopMotorFunctions()
stopTime += movement_time/2 * max_movement_time/(stopTime - nowTime)
else:
currentMotor = motor
speed = adjustment
stopTime = nowTime + movement_time
if(speed>0):
candy.setJOGcmd(motorcfg[currentMotor]['positive'])
#print("JOG command {}".format(motorcfg[currentMotor]['positive']))
else:
candy.setJOGcmd(motorcfg[currentMotor]['negative'])
# print("JOG command {}".format(motorcfg[currentMotor]['negative']))
def stopMotorFunctions():
global currentMotor, speed
currentMotor = 0
speed = 0
candy.stop()
def updateLoop():
global nowTime, stopTime, currentMotor, speed, friction, min_speed, motorcfg
nowTime = (time.time() - startTime)
threading.Timer(1, updateLoop).start()
if currentMotor != 0:
if nowTime > stopTime:
stopMotorFunctions()
return
else:
speed *= friction
if abs(speed) < min_speed:
stopMotorFunctions()
return
candy.setparams(motorcfg[currentMotor]['name'], abs(speed))
#print("JOG parameter {} to {}".format( motorcfg[currentMotor]['speedslot'], abs(speed)) )
def rt():
adjustSpeed(1, 5)
def lt():
adjustSpeed(1, -5)
def fw():
adjustSpeed(2, 5)
def bc():
adjustSpeed(2, -5)
def up():
adjustSpeed(3, 5)
def dn():
adjustSpeed(3, -5)
def lr():
adjustSpeed(4, 10)
def ll():
adjustSpeed(4, -10)
updateLoop()
#
#c = Candybot()
#
#
#def slide_left():
# c.linear(-1)
#
#def slide_right():
# c.linear(1)
#
#def rotate_left():
# c.base(-1)
#
#def rotate_right():
# c.base(1)
#
#def forward():
# c.forearm(1)
#
#def back():
# c.forearm(-1)
#
#def up():
# c.rearArm(1)
#
#def down():
# c.rearArm(-1)
#
def stopCmp():
candy.stopcmp()
def grab():
candy.gripp()
# c.stopcmp()
#
def drop():
candy.letgo()
# c.stopcmp()
#
def stop():
candy.panic()
#
#def getCurrentCmd():
# return c.getCurrentCmd()
#
#def updateLinearSpeed():
# pass
#

@ -0,0 +1,294 @@
import time
import threading
import DobotDllType as dType
"""
Six actuators:
linear rail
base rotation
rear arm
forarm
gripperrotation
gripper
First five takes argument 1 or -1 (direction)
Example:
#initialisation
c = Candybot()
c.linear(1) # move linear in positive direction
c.gripp() # gripp candy
c.letgo() # let go of candy
c.stopcmp() # stoop compressor
c.panic() # stops everything
"""
class Candybot:
def __init__(self):
self.jointspeed = 100
self.lastjointspeed = 100
self.linearspeed = 100
self.lastleinearspeed = 100
return
CON_STR = {
dType.DobotConnect.DobotConnect_NoError: "DobotConnect_NoError",
dType.DobotConnect.DobotConnect_NotFound: "DobotConnect_NotFound",
dType.DobotConnect.DobotConnect_Occupied: "DobotConnect_Occupied"}
#Load Dll
self.api = dType.load()
#Connect Dobot
state = dType.ConnectDobot(self.api, "", 115200)[0]
print("Connect status:",CON_STR[state])
if (state == dType.DobotConnect.DobotConnect_NoError):
#Clean Command Queued
dType.SetQueuedCmdClear(self.api)
#Async Motion Params Setting
dType.SetHOMEParams(self.api, 250, 0, 50, 0, isQueued = 1)
dType.SetJOGJointParams(self.api, 2, 200, 2, 200, 2, 200, 2, 200, isQueued = 1)
dType.SetJOGCommonParams(self.api, 100, 100, isQueued = 1)
#linear rail
dType.SetDeviceWithL(self.api, 1)
dType.SetJOGLParams(self.api, 200, 200, isQueued=0)
#Async Home
dType.SetHOMECmd(self.api, temp = 0, isQueued = 1)
def disconnect(self):
#Disconnect Dobot
dType.DisconnectDobot(self.api)
def base(self, direction):
if direction == 1:
dType.SetJOGCmd(self.api,1,1)
elif direction == -1:
dType.SetJOGCmd(self.api,1,2)
else :
return
threading.Timer(0.1,self.stop).start()
#dType.SetWAITCmd(self.api, 1, isQueued=0)
#dType.SetJOGCmd(self.api, 1, 0)
def rearArm(self, direction):
if direction == 1:
dType.SetJOGCmd(self.api,1,3)
elif direction == -1:
dType.SetJOGCmd(self.api,1,4)
else :
return
#dType.SetWAITCmd(self.api, 1, isQueued=0)
#dType.SetJOGCmd(self.api, 1, 0)
threading.Timer(0.1,self.stop).start()
def forearm(self, direction):
if direction == 1:
dType.SetJOGCmd(self.api,1,5)
elif direction == -1:
dType.SetJOGCmd(self.api,1,6)
else :
return
#dType.SetWAITCmd(self.api, 1, isQueued=0)
#dType.SetJOGCmd(self.api, 1, 0)
threading.Timer(0.1,self.stop).start()
def gripperRotation(self, direction):
if direction == 1:
dType.SetJOGCmd(self.api,1,7)
elif direction == -1:
dType.SetJOGCmd(self.api,1,8)
else :
return
#dType.SetWAITCmd(self.api, 1, isQueued=0)
#dType.SetJOGCmd(self.api, 1, 0)
threading.Timer(0.1,self.stop).start()
def linear(self, direction):
if direction == 1:
dType.SetJOGCmd(self.api,1,9)
elif direction == -1:
dType.SetJOGCmd(self.api,1,10)
else :
return
#dType.SetWAITCmd(self.api, 1, isQueued=0)
#dType.SetJOGCmd(self.api, 1, 0)
self.lint = threading.Timer(0.2,self.stop)
self.lint.start()
def gripp(self):
print("gripping\n")
#dType.SetEndEffectorGripper(self.api, 1, 1, isQueued=0)
def letgo(self):
print("drops\n")
#dType.SetEndEffectorGripper(self.api, 1, 0, isQueued=0)
def stop(self):
print("stops\n")
#dType.SetJOGCmd(self.api, 1, 0)
def stopcmp(self):
print("stops compressor\n")
dType.SetEndEffectorGripper(self.api, 0, 0, isQueued=0)
def panic(self):
dType.SetQueuedCmdForceStopExec(self.api)
def getCurrentCmd(self):
return dType.GetQueuedCmdCurrentIndex(self.api)
def JOGtest(self):
dType.SetJOGCmd(self.api,1,1)
dType.SetJOGCmd(self.api,1,9)
def JOGtest2(self):
dType.SetJOGLParams(self.api, 100, 200, isQueued=0)
dType.SetJOGCmd(self.api,1,9)
time.sleep(1)
for speed in range(100,10,-10):
time.sleep(0.3)
dType.SetJOGLParams(self.api, speed, 200, isQueued=0)
def setparams(self, name, speed):
lookup = {'base' : 0, 'reararm' : 1, 'forearm' : 2, 'gripperroation' :3}
if name == 'rail':
print("Change speed rail " + str(speed) +"\n" )
#dType.SetJOGLParams(self.api, speed, 200, isQueued=0)
else:
speeds = [0,0,0,0]
speeds[lookup[name]] = speed
print("change speed " + name + str(speed))
#dType.SetJOGJointParams(self.api, speeds[0], 200, speeds[1], 200, speeds[2], 200, speeds[3], 200, isQueued = 1)
def setJOGcmd(self, cmd):
print("Joint "+ str(cmd) + "is moving \n")
#dType.SetJOGCmd(self.api,1,cmd)
candy = Candybot()
startTime = time.time()
nowTime = 0
currentMotor = 0
motorcfg = [0] * 10
motorcfg[1] = {"name" : 'base' , "positive":1, "negative":2, 'speedslot':2}
motorcfg[2] = {"name" : 'reararm' ,"positive":3, "negative":4, 'speedslot':4}
motorcfg[3] = {"name" : 'forearm' ,"positive":5, "negative":6, 'speedslot':6}
motorcfg[4] = {"name" : 'rail' ,"positive":9, "negative":10, 'speedslot':1}
friction = 0.95
movement_time = 3
max_movement_time = 5
min_speed = 1
max_speed = 100
speed = 0
stopTime = 0
isRunning = False
def adjustSpeed(motor, adjustment):
global nowTime, stopTime, currentMotor, speed, motorcfg, movement_time, max_speed, max_movement_time
if currentMotor==motor:
if (adjustment>0 and speed>0) or (adjustment<0 and speed<0):
speed += adjustment * (abs(speed)/max_speed)
else:
stopMotorFunctions()
stopTime += movement_time/2 * max_movement_time/(stopTime - nowTime)
else:
currentMotor = motor
speed = adjustment
stopTime = nowTime + movement_time
if(speed>0):
candy.setJOGcmd(motorcfg[currentMotor]['positive'])
#print("JOG command {}".format(motorcfg[currentMotor]['positive']))
else:
candy.setJOGcmd(motorcfg[currentMotor]['negative'])
# print("JOG command {}".format(motorcfg[currentMotor]['negative']))
def stopMotorFunctions():
global currentMotor, speed
currentMotor = 0
speed = 0
candy.stop()
def updateLoop():
global nowTime, stopTime, currentMotor, speed, friction, min_speed, motorcfg
nowTime = (time.time() - startTime)
threading.Timer(1, updateLoop).start()
if currentMotor != 0:
if nowTime > stopTime:
stopMotorFunctions()
return
else:
speed *= friction
if abs(speed) < min_speed:
stopMotorFunctions()
return
candy.setparams(motorcfg[currentMotor]['name'], abs(speed))
#print("JOG parameter {} to {}".format( motorcfg[currentMotor]['speedslot'], abs(speed)) )
def rt():
adjustSpeed(1, 5)
def lt():
adjustSpeed(1, -5)
def fw():
adjustSpeed(2, 5)