Skip to content

Commit

Permalink
Max priority for receive thread, because of missing UDP packets
Browse files Browse the repository at this point in the history
  • Loading branch information
douwefokkema committed Jun 4, 2018
1 parent 2ab1184 commit 136584d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/RadarMarpa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ void ArpaTarget::RefreshTarget(int dist) {
}*/

// PREDICTION CYCLE

m_position.time = time1; // estimated new target time
delta_t = ((double)((m_position.time - prev_X.time).GetLo())) / 1000.; // in seconds
if (m_status == 0) {
Expand All @@ -712,7 +713,9 @@ void ArpaTarget::RefreshTarget(int dist) {
return;
}
m_expected = pol; // save expected polar position
// Measurement cycle

//MEASUREMENT CYCLE

// now search for the target at the expected polar position in pol
int dist1 = dist;
Polar back = pol;
Expand Down Expand Up @@ -880,13 +883,14 @@ void ArpaTarget::RefreshTarget(int dist) {
bool ArpaTarget::FindNearestContour(Polar* pol, int dist) {
// make a search pattern along a square
// returns the position of the nearest blob found in pol
// dist is search radius (1 more or less)
// dist is search radius (1 more or less) in radial pixels
int a = pol->angle;
int r = pol->r;
if (dist < 2) dist = 2;
for (int j = 1; j <= dist; j++) {
int dist_r = j;
int dist_a = (int)(326. / (double)r * j); // 326/r: conversion factor to make squares
// if r == 326 circle would be 28 * PI * 326 = 2048
if (dist_a == 0) dist_a = 1;
for (int i = 0; i <= dist_a; i++) { // "upper" side
PIX(a - i, r + dist_r); // search starting from the middle
Expand Down
4 changes: 2 additions & 2 deletions src/RadarMarpa.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class Position;
#define TARGET_SEARCH_RADIUS2 (15) // radius of target search area for pass 1
#define SCAN_MARGIN (150) // number of lines that a next scan of the target may have moved
#define SCAN_MARGIN2 (1000) // if target is refreshed after this time you will be shure it is the next sweep
#define MAX_CONTOUR_LENGTH (601) // defines maximal size of target contour
#define MAX_TARGET_DIAMETER (200) // target will be set lost if diameter larger than this value
#define MAX_CONTOUR_LENGTH (601) // defines maximal size of target contour in pixels
#define MAX_TARGET_DIAMETER (200) // target will be set lost if diameter in pixels is larger than this value
#define MAX_LOST_COUNT (3) // number of sweeps that target can be missed before it is set to lost

#define FOR_DELETION (-2) // status of a duplicate target used to delete a target
Expand Down
4 changes: 2 additions & 2 deletions src/navico/NavicoReceive.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class NavicoReceive : public RadarReceive {
m_receive_socket = GetLocalhostServerTCPSocket();
m_send_socket = GetLocalhostSendTCPSocket(m_receive_socket);
SetInfoStatus(wxString::Format(wxT("%s: %s"), m_ri->m_name.c_str(), _("Initializing")));

LOG_RECEIVE(wxT("radar_pi: %s receive thread created"), m_ri->m_name.c_str());
SetPriority(wxPRIORITY_MAX);
LOG_INFO(wxT("radar_pi: %s receive thread created, prio= %i"), m_ri->m_name.c_str(), GetPriority());
};

~NavicoReceive() {}
Expand Down

0 comments on commit 136584d

Please sign in to comment.