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

fixed memorry corruption #8

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions include/mavlink_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class MavlinkInterface {
struct pollfd fds_[N_FDS];
bool use_tcp_{false};
bool tcp_client_mode_{false};
bool close_conn_{false};
std::atomic<bool> close_conn_{false};

in_addr_t mavlink_addr_;
std::string mavlink_addr_str_{"INADDR_ANY"};
Expand Down Expand Up @@ -230,18 +230,18 @@ class MavlinkInterface {
std::atomic<bool> tx_in_progress_;
std::deque<MsgBuffer> tx_q_{};

bool baro_updated_;
bool diff_press_updated_;
bool mag_updated_;
bool imu_updated_;

double temperature_;
double pressure_alt_;
double abs_pressure_;
double diff_pressure_;
Eigen::Vector3d mag_b_;
Eigen::Vector3d accel_b_;
Eigen::Vector3d gyro_b_;
bool baro_updated_{};
bool diff_press_updated_{};
bool mag_updated_{};
bool imu_updated_{};

double temperature_{};
double pressure_alt_{};
double abs_pressure_{};
double diff_pressure_{};
Eigen::Vector3d mag_b_{};
Eigen::Vector3d accel_b_{};
Eigen::Vector3d gyro_b_{};

//std::vector<HILData, Eigen::aligned_allocator<HILData>> hil_data_;
std::atomic<bool> gotSigInt_ {false};
Expand Down
10 changes: 6 additions & 4 deletions src/mavlink_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void MavlinkInterface::ReceiveWorker() {
}
}
}
std::cout << "[" << thrd_name << "] shutdown" << std::endl;
std::cout << "The thread [" << thrd_name << "] was shutdown." << std::endl;

}

Expand Down Expand Up @@ -264,8 +264,10 @@ void MavlinkInterface::SendWorker() {
return close_conn_ || gotSigInt_ || !sender_buffer_.empty();
});

std::shared_ptr<mavlink_message_t> msg;
msg = sender_buffer_.front();
if (sender_buffer_.empty())
continue;

auto msg = sender_buffer_.front();
if (msg) {
sender_buffer_.pop();
lock.unlock();
Expand All @@ -275,7 +277,7 @@ void MavlinkInterface::SendWorker() {
}
}

std::cout << "[" << thrd_name << "] Shutdown.." << std::endl;
std::cout << "The thread [" << thrd_name << "] was shutdown." << std::endl;
}

void MavlinkInterface::SendSensorMessages(uint64_t time_usec) {
Expand Down
Loading