From af8969e3d37b291ade479542128fa614fbe2f4a9 Mon Sep 17 00:00:00 2001 From: Richard Date: Tue, 6 Jun 2023 12:32:41 +0100 Subject: [PATCH 1/3] added stop_decel and quick_stop_decel params to epd config --- src/jsd_epd.c | 13 +++++++++++++ src/jsd_epd_types.h | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/jsd_epd.c b/src/jsd_epd.c index 7fd640f..37c36cb 100644 --- a/src/jsd_epd.c +++ b/src/jsd_epd.c @@ -626,6 +626,19 @@ int jsd_epd_config_LC_params(ecx_contextt* ecx_context, uint16_t slave_id, return 0; } + if (!jsd_sdo_set_param_blocking(ecx_context, slave_id, jsd_epd_lc_to_do("QS"), + 1, JSD_SDO_DATA_DOUBLE, + &config->epd.quick_stop_decel)) { + return 0; + } + + if (!jsd_sdo_set_param_blocking(ecx_context, slave_id, jsd_epd_lc_to_do("SD"), + 1, JSD_SDO_DATA_DOUBLE, + &config->epd.stop_decel)) { + return 0; + } + + if (!jsd_sdo_set_param_blocking(ecx_context, slave_id, jsd_epd_lc_to_do("ER"), 2, JSD_SDO_DATA_DOUBLE, &config->epd.velocity_tracking_error)) { diff --git a/src/jsd_epd_types.h b/src/jsd_epd_types.h index 150ad57..3d87544 100644 --- a/src/jsd_epd_types.h +++ b/src/jsd_epd_types.h @@ -122,6 +122,8 @@ typedef struct { // RxPDO. double max_profile_accel; ///< P_AC[1]. Ignored by CS mode. double max_profile_decel; ///< P_DC[1]. Ignored by CS mode. + double quick_stop_decel; /// used when quick stop command sent + double stop_decel; /// used for emergency stops and limit switches double velocity_tracking_error; ///< P_ER[2] cnts/s double position_tracking_error; ///< P_ER[3] cnts float peak_current_limit; ///< P_PL[1] A @@ -139,6 +141,7 @@ typedef struct { int16_t brake_engage_msec; ///< BP[1] ms, [0, 1000] int16_t brake_disengage_msec; ///< BP[2] ms, [0, 1000] + // Verification parameters uint32_t crc; ///< CZ[1], changes whenever drive parameters change // TODO(dloret): Consider whether it is worth to have a parameter that @@ -312,4 +315,4 @@ typedef struct { } #endif -#endif \ No newline at end of file +#endif From af544004326fa51205803509ece80e24b34c1ea8 Mon Sep 17 00:00:00 2001 From: Richard Date: Tue, 6 Jun 2023 12:58:07 +0100 Subject: [PATCH 2/3] updated two letter command lookup table --- src/jsd_epd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/jsd_epd.c b/src/jsd_epd.c index 37c36cb..77e729e 100644 --- a/src/jsd_epd.c +++ b/src/jsd_epd.c @@ -37,6 +37,8 @@ static const jsd_epd_lc_pair_t jsd_epd_lc_lookup_table[] = { {"MC", 0x31BC}, {"PL", 0x3231}, {"PX", 0x323D}, + {"QS", 0x325C}, + {"SD", 0x3295}, {"SF", 0x3297}, {"UM", 0x32E6}, }; From 7bcda4c3ef0b5c5f2715bd9b614c3ee776b67a26 Mon Sep 17 00:00:00 2001 From: Richard Date: Tue, 6 Jun 2023 14:17:38 +0100 Subject: [PATCH 3/3] updated and tested all test cases except epd_network_test --- test/device/jsd_epd_csp_sine_test.c | 4 +++- test/device/jsd_epd_cst_test.c | 4 +++- test/device/jsd_epd_csv_sine_test.c | 4 +++- test/device/jsd_epd_network_test.c | 4 +++- test/device/jsd_epd_prof_pos_test.c | 4 +++- test/device/jsd_epd_prof_torque_test.c | 4 +++- test/device/jsd_epd_prof_vel_test.c | 4 +++- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/test/device/jsd_epd_csp_sine_test.c b/test/device/jsd_epd_csp_sine_test.c index 3c8bcc5..b3782f4 100644 --- a/test/device/jsd_epd_csp_sine_test.c +++ b/test/device/jsd_epd_csp_sine_test.c @@ -211,6 +211,8 @@ int main(int argc, char* argv[]) { config.epd.torque_slope = 1e7; config.epd.max_profile_accel = 1e6; config.epd.max_profile_decel = 1e7; + config.epd.quick_stop_decel = 1e7; + config.epd.stop_decel = 1e7; config.epd.velocity_tracking_error = 1e8; config.epd.position_tracking_error = 1e9; config.epd.peak_current_limit = peak_current; @@ -239,4 +241,4 @@ int main(int argc, char* argv[]) { sds_run(&sds, ifname, "/tmp/jsd_epd_csp_sine_test.csv"); return 0; -} \ No newline at end of file +} diff --git a/test/device/jsd_epd_cst_test.c b/test/device/jsd_epd_cst_test.c index ba4571a..8c6ea70 100644 --- a/test/device/jsd_epd_cst_test.c +++ b/test/device/jsd_epd_cst_test.c @@ -200,6 +200,8 @@ int main(int argc, char* argv[]) { config.epd.torque_slope = 1e7; config.epd.max_profile_accel = 1e6; config.epd.max_profile_decel = 1e7; + config.epd.quick_stop_decel = 1e7; + config.epd.stop_decel = 1e7; config.epd.velocity_tracking_error = 1e8; config.epd.position_tracking_error = 1e9; config.epd.peak_current_limit = peak_current; @@ -228,4 +230,4 @@ int main(int argc, char* argv[]) { sds_run(&sds, ifname, "/tmp/jsd_epd_cst_test.csv"); return 0; -} \ No newline at end of file +} diff --git a/test/device/jsd_epd_csv_sine_test.c b/test/device/jsd_epd_csv_sine_test.c index 8e09c66..c32872a 100644 --- a/test/device/jsd_epd_csv_sine_test.c +++ b/test/device/jsd_epd_csv_sine_test.c @@ -202,6 +202,8 @@ int main(int argc, char* argv[]) { config.epd.torque_slope = 1e7; config.epd.max_profile_accel = 1e6; config.epd.max_profile_decel = 1e7; + config.epd.quick_stop_decel = 1e7; + config.epd.stop_decel = 1e7; config.epd.velocity_tracking_error = 1e8; config.epd.position_tracking_error = 1e9; config.epd.peak_current_limit = peak_current; @@ -230,4 +232,4 @@ int main(int argc, char* argv[]) { sds_run(&sds, ifname, "/tmp/jsd_epd_csv_sine_test.csv"); return 0; -} \ No newline at end of file +} diff --git a/test/device/jsd_epd_network_test.c b/test/device/jsd_epd_network_test.c index 186600c..0a9b6c1 100644 --- a/test/device/jsd_epd_network_test.c +++ b/test/device/jsd_epd_network_test.c @@ -281,6 +281,8 @@ int main(int argc, char* argv[]) { epd_config.epd.torque_slope = 1e7; epd_config.epd.max_profile_accel = 1e6; epd_config.epd.max_profile_decel = 1e7; + epd_config.epd.quick_stop_decel = 1e7; + epd_config.epd.stop_decel = 1e7; epd_config.epd.velocity_tracking_error = 1e8; epd_config.epd.position_tracking_error = 1e9; epd_config.epd.peak_current_limit = peak_current; @@ -329,4 +331,4 @@ int main(int argc, char* argv[]) { sds_run(&sds, ifname, "/tmp/jsd_epd_network_test.csv"); return 0; -} \ No newline at end of file +} diff --git a/test/device/jsd_epd_prof_pos_test.c b/test/device/jsd_epd_prof_pos_test.c index bc8963d..3b46435 100644 --- a/test/device/jsd_epd_prof_pos_test.c +++ b/test/device/jsd_epd_prof_pos_test.c @@ -264,6 +264,8 @@ int main(int argc, char* argv[]) { config.epd.torque_slope = 1e7; config.epd.max_profile_accel = 1e6; config.epd.max_profile_decel = 1e7; + config.epd.quick_stop_decel = 1e7; + config.epd.stop_decel = 1e7; config.epd.velocity_tracking_error = 1e8; config.epd.position_tracking_error = 1e9; config.epd.peak_current_limit = peak_current; @@ -292,4 +294,4 @@ int main(int argc, char* argv[]) { sds_run(&sds, ifname, "/tmp/jsd_epd_prof_pos_test.csv"); return 0; -} \ No newline at end of file +} diff --git a/test/device/jsd_epd_prof_torque_test.c b/test/device/jsd_epd_prof_torque_test.c index a6176bc..ccc07f6 100644 --- a/test/device/jsd_epd_prof_torque_test.c +++ b/test/device/jsd_epd_prof_torque_test.c @@ -197,6 +197,8 @@ int main(int argc, char* argv[]) { config.epd.torque_slope = 1e7; config.epd.max_profile_accel = 1e6; config.epd.max_profile_decel = 1e7; + config.epd.quick_stop_decel = 1e7; + config.epd.stop_decel = 1e7; config.epd.velocity_tracking_error = 1e8; config.epd.position_tracking_error = 1e9; config.epd.peak_current_limit = peak_current; @@ -225,4 +227,4 @@ int main(int argc, char* argv[]) { sds_run(&sds, ifname, "/tmp/jsd_epd_prof_torque_test.csv"); return 0; -} \ No newline at end of file +} diff --git a/test/device/jsd_epd_prof_vel_test.c b/test/device/jsd_epd_prof_vel_test.c index efd05aa..305e6ca 100644 --- a/test/device/jsd_epd_prof_vel_test.c +++ b/test/device/jsd_epd_prof_vel_test.c @@ -213,6 +213,8 @@ int main(int argc, char* argv[]) { config.epd.torque_slope = 1e7; config.epd.max_profile_accel = 1e6; config.epd.max_profile_decel = 1e7; + config.epd.quick_stop_decel = 1e7; + config.epd.stop_decel = 1e7; config.epd.velocity_tracking_error = 1e8; config.epd.position_tracking_error = 1e9; config.epd.peak_current_limit = peak_current; @@ -241,4 +243,4 @@ int main(int argc, char* argv[]) { sds_run(&sds, ifname, "/tmp/jsd_epd_prof_vel_test.csv"); return 0; -} \ No newline at end of file +}