Skip to content

Commit

Permalink
Slow down the gyro's speed when shooting buff.
Browse files Browse the repository at this point in the history
  • Loading branch information
liyixin135 committed May 29, 2024
1 parent abdcb34 commit 53638d4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion rm_common/include/rm_common/decision/command_sender.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class Vel2DCommandSender : public CommandSenderBase<geometry_msgs::Twist>
max_angular_z_.init(xml_rpc_value);
std::string topic;
nh.getParam("power_limit_topic", topic);
target_vel_yaw_threshold_ = getParam(nh, "target_vel_yaw_threshold", 4.);
target_vel_yaw_threshold_ = getParam(nh, "target_vel_yaw_threshold", 3.);
chassis_power_limit_subscriber_ =
nh.subscribe<rm_msgs::ChassisCmd>(topic, 1, &Vel2DCommandSender::chassisCmdCallback, this);
}
Expand All @@ -186,6 +186,15 @@ class Vel2DCommandSender : public CommandSenderBase<geometry_msgs::Twist>
vel_direction_ = 1.;
msg_.angular.z = scale * max_angular_z_.output(power_limit_) * vel_direction_;
};
void setAngularZVel(double scale, double limit)
{
if (track_data_.v_yaw > target_vel_yaw_threshold_)
vel_direction_ = -1.;
if (track_data_.v_yaw < -target_vel_yaw_threshold_)
vel_direction_ = 1.;
double angular_z = max_angular_z_.output(power_limit_) > limit ? limit : max_angular_z_.output(power_limit_);
msg_.angular.z = scale * angular_z * vel_direction_;
};
void set2DVel(double scale_x, double scale_y, double scale_z)
{
setLinearXVel(scale_x);
Expand Down

0 comments on commit 53638d4

Please sign in to comment.