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

Airsim receiver can accept pose messages from more than one gazebo instance #36

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

murphym18
Copy link
Collaborator

airsim receiver can accept pose messages from more than one gazebo instance
Fixes #35
To implement this we need to:

  • Maintain a unique message count for each drone
  • Use a unique drone ID across all gazebo instances

So every time we send a pose message for the "red" drone, we must number each message, starting at 1, then counting up by one for each subsequent message.

And every time we send a pose message for the "blue" drone, we will do the same thing, starting at one, and counting up by one each time.

Please note our drones are "named" using a 16bit integer, but the concept still applies.

Previously, there was a global message count. This was limiting us to exactly 1 sUAS engine. But when deploying to the HPC cluster we get better results when we deploy more than one sUAS engine.

So every time we send a pose message for the "red" drone, we will number each message, starting at 1, then counting up by one for each subsequent message.

And every time we send a pose message for the "blue" drone, we will do the same thing, starting at one, and counting up by one each time.

Please note our drones are "named" using a 16bit integer, but the concept still applies.
spawn_unique_drone(vehicle_interface, pose_message->drone_id, pose_message->drone);
}

// Please recall that the message count starts at 1, and increments by 1 each time
// also each drone has its own message count
// if the message count is greater than the last message count, then we have new information
if (pose_message->message_counter > msg_count) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if messages can be received in different order than they are sent. Also, should we have a another incremental count on reciver side too? If the largest message count for that drone and total received message count is not name, that will imply packet loss.

@@ -41,18 +41,37 @@ void PoseHandlers::set_drone_pose(
bool *exit_flag
) {
uint64_t msg_count = 0;
std::unordered_map<uint16_t, uint64_t> messageCount;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requires #include <unordered_map>

// no, we have not seen this drone before
// let's clear the message count
// and spawn a new drone
msg_count = 0;
spawn_unique_drone(vehicle_interface, pose_message->drone_id, pose_message->drone);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This spawns a new drone with id 0 as soon as program starts.

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.

Feature: airsim reciever can accept pose messages from more than one sUAS engine
2 participants