Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Stop Decel and Quick Stop Decel parameters to Elmo Platinum Drive #83

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/jsd_epd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};
Expand Down Expand Up @@ -626,6 +628,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)) {
Expand Down
5 changes: 4 additions & 1 deletion src/jsd_epd_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -312,4 +315,4 @@ typedef struct {
}
#endif

#endif
#endif
4 changes: 3 additions & 1 deletion test/device/jsd_epd_csp_sine_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -239,4 +241,4 @@ int main(int argc, char* argv[]) {
sds_run(&sds, ifname, "/tmp/jsd_epd_csp_sine_test.csv");

return 0;
}
}
4 changes: 3 additions & 1 deletion test/device/jsd_epd_cst_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -228,4 +230,4 @@ int main(int argc, char* argv[]) {
sds_run(&sds, ifname, "/tmp/jsd_epd_cst_test.csv");

return 0;
}
}
4 changes: 3 additions & 1 deletion test/device/jsd_epd_csv_sine_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -230,4 +232,4 @@ int main(int argc, char* argv[]) {
sds_run(&sds, ifname, "/tmp/jsd_epd_csv_sine_test.csv");

return 0;
}
}
4 changes: 3 additions & 1 deletion test/device/jsd_epd_network_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -329,4 +331,4 @@ int main(int argc, char* argv[]) {
sds_run(&sds, ifname, "/tmp/jsd_epd_network_test.csv");

return 0;
}
}
4 changes: 3 additions & 1 deletion test/device/jsd_epd_prof_pos_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -292,4 +294,4 @@ int main(int argc, char* argv[]) {
sds_run(&sds, ifname, "/tmp/jsd_epd_prof_pos_test.csv");

return 0;
}
}
4 changes: 3 additions & 1 deletion test/device/jsd_epd_prof_torque_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -225,4 +227,4 @@ int main(int argc, char* argv[]) {
sds_run(&sds, ifname, "/tmp/jsd_epd_prof_torque_test.csv");

return 0;
}
}
4 changes: 3 additions & 1 deletion test/device/jsd_epd_prof_vel_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -241,4 +243,4 @@ int main(int argc, char* argv[]) {
sds_run(&sds, ifname, "/tmp/jsd_epd_prof_vel_test.csv");

return 0;
}
}