Skip to content

Commit

Permalink
latency_msをlaunchで設定できるようにする (#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
HansRobo authored Aug 4, 2024
1 parent 96c4e6e commit 7178c82
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions crane_bringup/launch/crane.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<group if="$(var original_grsim)">
<node pkg="crane_sender" exec="sim_sender_node" output="screen">
<param name="no_movement" value="false"/>
<param name="latency_ms" value="0.0"/>
<param name="k_gain" value="2.0"/>
<param name="i_gain" value="0.0"/>
<param name="d_gain" value="0.1"/>
Expand All @@ -68,6 +69,7 @@
<group unless="$(var original_grsim)">
<node pkg="crane_sender" exec="ibis_sender_node" output="screen">
<param name="no_movement" value="false"/>
<param name="latency_ms" value="0.0"/>
<param name="theta_kp" value="3.5"/>
<param name="theta_ki" value="0.0"/>
<param name="theta_kd" value="0.5"/>
Expand Down
3 changes: 3 additions & 0 deletions crane_sender/include/crane_sender/sender_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class SenderBase : public rclcpp::Node
declare_parameter<double>("delay_s", 0.0);
get_parameter("delay_s", delay_s);

declare_parameter<double>("latency_ms", 0.0);
get_parameter("latency_ms", current_latency_ms);

// the parameters of the PID controller
declare_parameter<float>("theta_kp", 4.0);
declare_parameter<float>("theta_ki", 0.0);
Expand Down
2 changes: 1 addition & 1 deletion crane_sender/src/ibis_sender_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class IbisSenderNode : public SenderBase
std::vector<uint8_t> available_ids = world_model->ours.getAvailableRobotIds();
return std::count(available_ids.begin(), available_ids.end(), command.robot_id) == 1;
}();
packet.latency_time_ms = 100; // TODO(Hans): ちゃんと計測する
packet.latency_time_ms = current_latency_ms; // TODO(Hans): ちゃんと計測する
packet.target_global_theta = command.target_theta;
packet.kick_power = std::clamp(command.kick_power, 0.f, 1.f);
packet.dribble_power = std::clamp(command.dribble_power, 0.f, 1.f);
Expand Down

0 comments on commit 7178c82

Please sign in to comment.