Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add r2r_spl package, capable of listening to different msg types #47

Merged
merged 11 commits into from Jan 20, 2024

Conversation

ijnek
Copy link
Member

@ijnek ijnek commented Dec 30, 2023

The 2023 SPL rule states that

The content structure of wireless team communication is not specified anymore. A team message is now defined as any UDP packet with up to 128 B payload on the team’s assigned UDP port

Great, now teams can use the whole packet size to pack in what they want their teammates to know about!

(Me): Crap, how do i even write a package that translates ROS messages to UDP packets if i don't know the message we're sending, and it's different for every team......... anyway, here's the solution I have.

This new package r2r_spl allows teams to publish / subscribe messages to each other, while adhering to SPL rules. When you publish a ROS message, this node will encode it, send it on a port specified by SPL rules for your team. Your teammate robot, who will also be running this node, will receive it, decode it into a ROS message, and publish it onto a topic!

One just has to specify the type of message they want to send to other robots on their team, by setting the msg_type parameter.

The node in the package dynamically imports the specified message type and inspects it to create a python construct.struct. When messages arrive on the r2r/send topic, it will use that information to fill out a struct.container, into binary data to be sent off.

Subscriptions:

  • r2r/send: Topic you publish your message to, to send to other robots
  • gc/data: Topic published by the gc_spl package, with information about number of remaining packets.

Publisher:

  • r2r/recv: Topic you subscribe to, to listen for messages from other robots

Parameters:

  • team_num: Team number of the robot. Used to calculate the team's port to communicate on.
  • player_num: Player number of the robot. Only used if filter_own parameter is set to true.
  • msg_type: This is used to determine what the type of message we're sending, provided in the form (eg. r2r_spl_8.msg.SPLSM).
  • filter_own: Used to determine whether to filter out messages that we sent to ourselves, by prepending player_num to the packets we're sending. The minor drawback to this, is that it takes up one extra byte in the packet we're sending.

SPL Rule Enforcement:

  • 128 Byte maximum packet size rule: A size check is made before sending the packet to ensure the 128B maximum packet size has not been exceeded. If it has, it will print an error.

  • Message budget:

    A team may not exceed 1200 packets per game. For each minute of irregular extra time (see Section 3.14), the limit is increased by 60 packets.

    This is enforced by listening to the number of remaining packets from the gc_spl package (using the gc/data topic), preventing packets from being sent when the message budget becomes less than 10. Packet sending resumes if we receive information from the game controller about additional packet allowance in the case of irregular extra time.

Resolves: #42

@ijnek ijnek force-pushed the rolling-flexible-msg branch 3 times, most recently from a2fb78b to 2b0a5eb Compare December 30, 2023 03:37
Signed-off-by: Kenji Brameld <kenjibrameld@gmail.com>
@ijnek ijnek mentioned this pull request Dec 30, 2023
2 tasks
Signed-off-by: Kenji Brameld <kenjibrameld@gmail.com>
…er, and hence udp port number

Signed-off-by: Kenji Brameld <kenjibrameld@gmail.com>
Signed-off-by: Kenji Brameld <kenjibrameld@gmail.com>
Signed-off-by: Kenji Brameld <kenjibrameld@gmail.com>
Signed-off-by: Kenji Brameld <kenjibrameld@gmail.com>
Signed-off-by: Kenji Brameld <kenjibrameld@gmail.com>
@ijnek
Copy link
Member Author

ijnek commented Jan 20, 2024

There are failures in CI, despite the green CI flag....

Signed-off-by: Kenji Brameld <kenjibrameld@gmail.com>
Signed-off-by: Kenji Brameld <kenjibrameld@gmail.com>
Signed-off-by: Kenji Brameld <kenjibrameld@gmail.com>
Signed-off-by: Kenji Brameld <kenjibrameld@gmail.com>
@ijnek ijnek merged commit ded20cc into rolling Jan 20, 2024
2 checks passed
@ijnek ijnek deleted the rolling-flexible-msg branch January 20, 2024 23:55
@ijnek
Copy link
Member Author

ijnek commented Jan 20, 2024

@Mergifyio backport humble iron

Copy link

mergify bot commented Jan 20, 2024

backport humble iron

✅ Backports have been created

ijnek added a commit that referenced this pull request Jan 21, 2024
Add r2r_spl package, capable of listening to different msg types (backport #47)
ijnek added a commit that referenced this pull request Jan 21, 2024
Add r2r_spl package, capable of listening to different msg types (backport #47)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adapt repo to new rules, flexible r2r messages
2 participants