Skip to content

Commit

Permalink
Fix interactive data sender problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
GuraMumei committed Jul 10, 2024
1 parent ace6719 commit 142bd56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rm_referee/include/rm_referee/ui/interactive_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class SentryToRadar : public InteractiveSender
bool needSendInteractiveData() override;
void sendSentryToRadarData();
ros::Time last_get_data_time_;
float target_position_x_, target_position_y_;
float target_position_x_, target_position_y_, robot_id_;
};

} // namespace rm_referee
4 changes: 4 additions & 0 deletions rm_referee/src/ui/interactive_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ void BulletNumShare::updateBulletRemainData(const rm_msgs::BulletAllowance& data

void SentryToRadar::updateSentryAttackingTargetData(const rm_msgs::SentryAttackingTargetConstPtr& data)
{
robot_id_ = data->target_robot_ID;
target_position_x_ = data->target_position_x;
target_position_y_ = data->target_position_y;
last_get_data_time_ = ros::Time::now();
Expand All @@ -198,6 +199,9 @@ void SentryToRadar::sendSentryToRadarData()
sentry_attacking_target_data->header_data.receiver_id = RED_RADAR;
else
sentry_attacking_target_data->header_data.receiver_id = BLUE_RADAR;
sentry_attacking_target_data->target_robot_ID = robot_id_;
sentry_attacking_target_data->target_position_x = target_position_x_;
sentry_attacking_target_data->target_position_y = target_position_y_;
pack(tx_buffer_, tx_data, RefereeCmdId::INTERACTIVE_DATA_CMD, sizeof(SentryAttackingTargetData));
tx_len_ = k_header_length_ + k_cmd_id_length_ + static_cast<int>(sizeof(SentryAttackingTargetData) + k_tail_length_);
sendSerial(ros::Time::now(), sizeof(SentryAttackingTargetData));
Expand Down

0 comments on commit 142bd56

Please sign in to comment.