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

* This EMS 3.90 version fixes the bug that affected the stiff <-> compliant interaction mode transitions #498

Merged
merged 1 commit into from
Jun 7, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,21 @@ extern "C" {
#define EOMTHEEMSAPPLCFG_VERSION_MAJOR (VERSION_MAJOR_OFFSET+3)
// <o> minor <0-255>
// <o> minor <0-255>
#define EOMTHEEMSAPPLCFG_VERSION_MINOR 89
#define EOMTHEEMSAPPLCFG_VERSION_MINOR 90

// </h>version

// <h> build date
// <o> year <2010-2030>
#define EOMTHEEMSAPPLCFG_BUILDDATE_YEAR 2024
// <o> month <1-12>
#define EOMTHEEMSAPPLCFG_BUILDDATE_MONTH 5
#define EOMTHEEMSAPPLCFG_BUILDDATE_MONTH 6
// <o> day <1-31>
#define EOMTHEEMSAPPLCFG_BUILDDATE_DAY 27
#define EOMTHEEMSAPPLCFG_BUILDDATE_DAY 6
// <o> hour <0-23>
#define EOMTHEEMSAPPLCFG_BUILDDATE_HOUR 15
#define EOMTHEEMSAPPLCFG_BUILDDATE_HOUR 6
// <o> minute <0-59>
#define EOMTHEEMSAPPLCFG_BUILDDATE_MIN 29
#define EOMTHEEMSAPPLCFG_BUILDDATE_MIN 00
// </h>build date
// </h>Info

Expand Down
23 changes: 16 additions & 7 deletions emBODY/eBcode/arch-arm/embobj/plus/mc/JointSet.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ void JointSet_init(JointSet* o) //
o->posdir_ctrl_out_type = eomc_ctrl_out_type_n_a;
o->veldir_ctrl_out_type = eomc_ctrl_out_type_n_a;

o->pos_control_active = TRUE;
//o->pos_control_active = TRUE;
o->pos_control_active = FALSE;
o->trq_control_active = FALSE;
o->USE_SPEED_FBK_FROM_MOTORS = TRUE;

Expand Down Expand Up @@ -451,13 +452,13 @@ void JointSet_set_constraints(JointSet* o, const eOmc_jointSet_constraints_t *co

#endif

static int control_output_type(JointSet* o, int16_t control_mode)
static int control_output_type(JointSet* o, int16_t control_mode, int16_t interaction_mode)
{
if (control_mode == eomc_controlmode_cmd_force_idle) return eomc_ctrl_out_type_off;

if (control_mode == eomc_controlmode_cmd_idle) return eomc_ctrl_out_type_off;

if (o->interaction_mode == eOmc_interactionmode_stiff)
if (interaction_mode == eOmc_interactionmode_stiff)
{
switch (control_mode)
{
Expand Down Expand Up @@ -550,7 +551,7 @@ BOOL JointSet_set_control_mode(JointSet* o, eOmc_controlmode_command_t control_m
}
}

int motor_input_type = control_output_type(o, control_mode_cmd);
int motor_input_type = control_output_type(o, control_mode_cmd, o->interaction_mode);

if (motor_input_type == eomc_ctrl_out_type_n_a)
{
Expand Down Expand Up @@ -653,11 +654,14 @@ void JointSet_set_interaction_mode(JointSet* o, eOmc_interactionmode_t interacti
{
if (interaction_mode == o->interaction_mode) return;

if ((interaction_mode == eOmc_interactionmode_compliant) && (o->torque_ctrl_out_type == eomc_ctrl_out_type_n_a)) return;
//if ((interaction_mode == eOmc_interactionmode_compliant) && (o->torque_ctrl_out_type == eomc_ctrl_out_type_n_a)) return;

o->interaction_mode = interaction_mode;
int motor_input_type = control_output_type(o, o->control_mode, interaction_mode);

int motor_input_type = control_output_type(o, o->control_mode);
if (motor_input_type == eomc_ctrl_out_type_n_a) return;

o->interaction_mode = interaction_mode;
o->motor_input_type = motor_input_type;

JointSet_set_inner_control_flags(o);

Expand All @@ -674,6 +678,11 @@ void JointSet_set_interaction_mode(JointSet* o, eOmc_interactionmode_t interacti

for (int k=0; k<N; ++k)
{
if (Motor_is_running(o->motor+o->motors_of_set[k]))
{
Motor_set_run(o->motor+o->motors_of_set[k], o->motor_input_type);
}

Joint_set_interaction_mode(o->joint+o->joints_of_set[k], interaction_mode);
}
}
Expand Down