12 changed files with 360 additions and 121 deletions
-
9README.md
-
185app/MDK-ARM/app.uvguix.h_zha
-
90app/MDK-ARM/app.uvoptx
-
2dep/libiflytop_micro
-
2dep/libtrinamic
-
4src/board/device_io_service.cpp
-
7src/board/device_io_service.hpp
-
66src/board/hardware.cpp
-
15src/board/hardware.hpp
-
24src/lncubator_rotating_control_service.cpp
-
62src/lncubator_rotating_control_service.hpp
-
15src/umain.cpp
185
app/MDK-ARM/app.uvguix.h_zha
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1 +1 @@ |
|||
Subproject commit 645e10e79f235ef9a05d3026091d692b18f6b5f8 |
|||
Subproject commit bb1b993c2015abe36525a7876b17f076665433b4 |
@ -1 +1 @@ |
|||
Subproject commit eb0ae9632bd558e6f1727437fa58715200c79693 |
|||
Subproject commit cab741ca3a6c542ebf25e6ef3a1d46766d035f55 |
@ -0,0 +1,24 @@ |
|||
#include "lncubator_rotating_control_service.hpp"
|
|||
|
|||
using namespace iflytop; |
|||
|
|||
LncubatorRotatingControlService::LncubatorRotatingControlService() {} |
|||
LncubatorRotatingControlService::~LncubatorRotatingControlService() {} |
|||
|
|||
void LncubatorRotatingControlService::initialize(Hardware* hardware) { //
|
|||
m_hardware = hardware; |
|||
m_motor = &m_hardware->tmc4361motor1; |
|||
m_os = &m_hardware->m_deviceIoService; |
|||
|
|||
/**
|
|||
* @brief 电机必须工作在位置模式 |
|||
*/ |
|||
m_motor->setMotorInPositionMode(); |
|||
} |
|||
void LncubatorRotatingControlService::setVelocity(uint32_t velocityMax) { m_maxVelocity = velocityMax; } |
|||
void LncubatorRotatingControlService::rotate(uint32_t count) { |
|||
m_motor->moveBy(count, m_maxVelocity); |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,62 @@ |
|||
#pragma once
|
|||
#include "board\hardware.hpp"
|
|||
namespace iflytop { |
|||
/**
|
|||
* @brief |
|||
* 孵育盘 |
|||
* |
|||
* 1. 孵育船位X对其孵育盘出口 |
|||
* 2. 孵育船位X对其孵育盘入口 |
|||
* 3. 找零点 |
|||
* 4. 电机顺时针转x度 |
|||
* 5. 电机逆时针转x度 |
|||
* 6. 校准位置([0]参考标识类型:出口,入口,零点,[1]第几个孵育船); |
|||
* 7. 读取校准值 |
|||
* 8. 写入校准值 |
|||
* |
|||
*/ |
|||
|
|||
#define LNCUBATOR_MAX_POSITION_COUNT 20
|
|||
#define ZEROOFFSETCORRECTION 0
|
|||
|
|||
class LncubatorRotatingControlService { |
|||
public: |
|||
typedef enum { |
|||
REFPOINT_TYPE_OUTLET = 0, // 出口
|
|||
REFPOINT_TYPE_INLET, // 入口
|
|||
REFPOINT_TYPE_ZERO, // 零点
|
|||
} refpoint_t; |
|||
|
|||
private: |
|||
/* data */ |
|||
Hardware* m_hardware; |
|||
IflytopMicroOS* m_os; |
|||
TMC4361AImpl* m_motor; |
|||
|
|||
// 零点位置
|
|||
uint32_t m_zeroPosition; |
|||
// 便宜修正,第一个仓位中心距离零点的距离
|
|||
uint32_t m_ZeroOffsetCorrection; |
|||
|
|||
uint32_t m_maxVelocity = 0; |
|||
|
|||
public: |
|||
LncubatorRotatingControlService(); |
|||
~LncubatorRotatingControlService(); |
|||
|
|||
void initialize(Hardware* hardware); |
|||
void setVelocity(uint32_t velocityMax); |
|||
void rotate(uint32_t count); |
|||
|
|||
void moveToZero(); |
|||
void moveTo(refpoint_t refpoint, uint32_t positionIndex); |
|||
|
|||
/**
|
|||
* @brief 人工校准当前位置为指定位置 |
|||
* |
|||
* @param refpoint 参考点 |
|||
* @param positionIndex 第几个位置 |
|||
*/ |
|||
void calibrationPosition(refpoint_t refpoint, uint32_t positionIndex); |
|||
}; |
|||
} // namespace iflytop
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue