Skip to content

Commit

Permalink
Added the new fields to test_script_command_interface
Browse files Browse the repository at this point in the history
  • Loading branch information
URJala committed Jul 9, 2024
1 parent aae6fe3 commit 16d9aab
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/test_script_command_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ TEST_F(ScriptCommandInterfaceTest, test_force_mode)
urcl::vector6d_t wrench = { 20, 0, 40, 0, 0, 0 };
int32_t force_mode_type = 2;
urcl::vector6d_t limits = { 0.1, 0.1, 0.1, 0.785, 0.785, 1.57 };
float damping = 0.8;
float gain_scaling = 0.8;
double damping = 0.8;
double gain_scaling = 0.8;
script_command_interface_->startForceMode(&task_frame, &selection_vector, &wrench, force_mode_type, &limits, damping,
gain_scaling);

Expand Down Expand Up @@ -301,8 +301,16 @@ TEST_F(ScriptCommandInterfaceTest, test_force_mode)
EXPECT_EQ(received_limits[i], limits[i]);
}

// Test damping return
double received_damping = (double)message[26] / script_command_interface_->MULT_JOINTSTATE;
EXPECT_EQ(received_damping, damping);

// Test Gain scaling return
double received_gain = (double)message[27] / script_command_interface_->MULT_JOINTSTATE;
EXPECT_EQ(received_gain, gain_scaling);

// The rest of the message should be zero
int32_t message_sum = std::accumulate(std::begin(message) + 25, std::end(message), 0);
int32_t message_sum = std::accumulate(std::begin(message) + 27, std::end(message), 0);
int32_t expected_message_sum = 0;
EXPECT_EQ(message_sum, expected_message_sum);

Expand Down

0 comments on commit 16d9aab

Please sign in to comment.