max step<65

This commit is contained in:
Your Name
2026-01-12 17:55:22 +08:00
parent c80ca011dd
commit add2572f4b
2 changed files with 2 additions and 2 deletions

View File

@@ -124,7 +124,7 @@ private:
///bool activated_;
std::atomic<bool> activated_{false};
#define FREQUENCY 1000
#define CSP_MAX_VEL_COUNTS_PER_S 10000//65536
#define CSP_MAX_VEL_COUNTS_PER_S 65536
#define CSP_POS_DEADBAND 10
#define CSP_DEADBAND1 100 //CSP允许的误差(计数),原来是10
#define CSP_DEADBAND2 500

View File

@@ -672,7 +672,7 @@ void EthercatDriver::readData(){
///
//if(pos_cnt++%500==0)
// RCLCPP_INFO(rclcpp::get_logger("EthercatDriver"), "[%d],cur:%d,dst:%.1f",i,pos,target_pos);
#if 0
#if 1
vmax_acc[i] += (int64_t)CSP_MAX_VEL_COUNTS_PER_S; // +v [counts/s]
int32_t max_step = (int32_t)(vmax_acc[i] / FREQUENCY); // 下取整,得到本周期可用步长
vmax_acc[i] -= (int64_t)max_step * FREQUENCY; // 保留余数到下周期