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 flexible messaging #43

Closed
wants to merge 25 commits into from
Closed

add flexible messaging #43

wants to merge 25 commits into from

Conversation

ijnek
Copy link
Member

@ijnek ijnek commented Dec 14, 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


Before merging:

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 ijnek changed the title add interface to test flexible messaging add flexible messaging Dec 19, 2023
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>
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>
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 marked this pull request as ready for review December 27, 2023 03:32
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>
Signed-off-by: Kenji Brameld <kenjibrameld@gmail.com>
@ijnek
Copy link
Member Author

ijnek commented Dec 30, 2023

superceded by #47

@ijnek ijnek closed this Dec 30, 2023
@ijnek ijnek deleted the ijnek-flexible-msg branch December 30, 2023 03:39
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
1 participant