Skip to content

Commit

Permalink
scout_status: fixed motor id not set issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rdu-weston committed Jan 19, 2022
1 parent 6bff3e3 commit 0e56789
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions scout_base/include/scout_base/scout_messenger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class ScoutMessenger {
}

void PublishOdometryToROS(const MotionStateMessage &msg, double dt) {
auto ctime = ros::Time::now();
auto ctime = ros::Time::now();

// perform numerical integration to get an estimation of pose
double linear_speed = msg.linear_velocity;
Expand All @@ -161,8 +161,12 @@ class ScoutMessenger {
lateral_speed = 0;
}

double d_x = (linear_speed * std::cos(theta_) - lateral_speed * std::sin(theta_)) * dt;
double d_y = (linear_speed * std::sin(theta_) + lateral_speed * std::cos(theta_)) * dt;
double d_x =
(linear_speed * std::cos(theta_) - lateral_speed * std::sin(theta_)) *
dt;
double d_y =
(linear_speed * std::sin(theta_) + lateral_speed * std::cos(theta_)) *
dt;
double d_theta = angular_speed * dt;

position_x_ += d_x;
Expand Down Expand Up @@ -235,6 +239,7 @@ class ScoutMessenger {
// actuator_hs_state
uint8_t motor_id = actuator.actuator_hs_state[i].motor_id;

status_msg.actuator_states[motor_id].motor_id = motor_id;
status_msg.actuator_states[motor_id].rpm =
actuator.actuator_hs_state[i].rpm;
status_msg.actuator_states[motor_id].current =
Expand All @@ -245,6 +250,7 @@ class ScoutMessenger {
// actuator_ls_state
motor_id = actuator.actuator_ls_state[i].motor_id;

status_msg.actuator_states[motor_id].motor_id = motor_id;
status_msg.actuator_states[motor_id].driver_voltage =
actuator.actuator_ls_state[i].driver_voltage;
status_msg.actuator_states[motor_id].driver_temperature =
Expand Down

0 comments on commit 0e56789

Please sign in to comment.