Skip to content

Commit fdd7205

Browse files
committed
Fix odometry calculation of angular velocity to use chassis_length (car length) instead of wheelbase (car width)
1 parent 454f05c commit fdd7205

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

vesc_ackermann/include/vesc_ackermann/vesc_to_odom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class VescToOdom
2727
// conversion gain and offset
2828
double speed_to_erpm_gain_, speed_to_erpm_offset_;
2929
double steering_to_servo_gain_, steering_to_servo_offset_;
30-
double wheelbase_;
30+
double chassis_length_;
3131
bool publish_tf_;
3232

3333
// odometry state

vesc_ackermann/src/vesc_to_odom.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ VescToOdom::VescToOdom(ros::NodeHandle nh, ros::NodeHandle private_nh) :
3030
return;
3131
if (!getRequiredParam(nh, "steering_angle_to_servo_offset", steering_to_servo_offset_))
3232
return;
33-
if (!getRequiredParam(nh, "wheelbase", wheelbase_))
33+
if (!getRequiredParam(nh, "chassis_length", chassis_length_))
3434
return;
3535
}
3636
private_nh.param("publish_tf", publish_tf_, publish_tf_);
@@ -63,7 +63,7 @@ void VescToOdom::vescStateCallback(const vesc_msgs::VescStateStamped::ConstPtr&
6363
if (use_servo_cmd_) {
6464
current_steering_angle =
6565
( last_servo_cmd_->data - steering_to_servo_offset_ ) / steering_to_servo_gain_;
66-
current_angular_velocity = current_speed * tan(current_steering_angle) / wheelbase_;
66+
current_angular_velocity = current_speed * tan(current_steering_angle) / chassis_length_;
6767
}
6868

6969
// use current state as last state if this is our first time here

0 commit comments

Comments
 (0)