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

Updating point search task #67

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
25 changes: 21 additions & 4 deletions src/Tasks/CmasiPointSearchTaskService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#define COUT_FILE_LINE_MSG(MESSAGE) std::cout << "CMPS-CMPS-CMPS-CMPS:: CmasiPointSearch:" << __FILE__ << ":" << __LINE__ << ":" << MESSAGE << std::endl;std::cout.flush();
#define CERR_FILE_LINE_MSG(MESSAGE) std::cerr << "CMPS-CMPS-CMPS-CMPS:: CmasiPointSearch:" << __FILE__ << ":" << __LINE__ << ":" << MESSAGE << std::endl;std::cerr.flush();

#define STRING_XML_POINT_SEARCH_DISCRETIZATION_LEVEL "DiscretizationLevel"

namespace uxas
{
Expand Down Expand Up @@ -75,6 +75,22 @@ CmasiPointSearchTaskService::configureTask(const pugi::xml_node& ndComponent)
sstrErrors << "ERROR:: **c_Task_CmasiLineSearch::bConfigure failed to cast a PointSearchTask from the task pointer." << std::endl;
CERR_FILE_LINE_MSG(sstrErrors.str())
isSuccessful = false;
} else {
{
//////////////////////////////////////////////
//////////// PROCESS OPTIONS /////////////////
pugi::xml_node ndTaskOptions = ndComponent.child(m_taskOptions_XmlTag.c_str());
if (ndTaskOptions) {
for(pugi::xml_node ndTaskOption = ndTaskOptions.first_child(); ndTaskOption; ndTaskOption = ndTaskOption.next_sibling())
{
if(std::string(STRING_XML_POINT_SEARCH_DISCRETIZATION_LEVEL) == ndTaskOption.name())
{
//get the value attribute of the discretizationlevel
m_discretizationLevel = atoi(ndTaskOption.child_value());
}
}
}
}
}
}
else
Expand Down Expand Up @@ -146,9 +162,10 @@ void CmasiPointSearchTaskService::buildTaskPlanOptions()
}
else
{
// no set wedge, so standoff from any angle
double dHeadingCurrent_rad = 0.0;
double dHeadingTarget_rad = n_Const::c_Convert::dTwoPi() - wedgeDirectionIncrement;
// no set wedge, so standoff from evenly spaced angles (number based on discretization level). Similar logic could be placed in wedge logic (evenlyish spaced headings checked in wedge)
wedgeDirectionIncrement = n_Const::c_Convert::dTwoPi() / m_discretizationLevel;
double dHeadingCurrent_rad = 0.0; //start from true north
double dHeadingTarget_rad = n_Const::c_Convert::dTwoPi() - wedgeDirectionIncrement; // the target (2pi - increment) so we dont double check angle 0.0
while (n_Const::c_Convert::bCompareDouble(dHeadingTarget_rad, dHeadingCurrent_rad, n_Const::c_Convert::enGreaterEqual))
{
if (isCalculateOption(taskId, optionId, dHeadingCurrent_rad))
Expand Down
1 change: 1 addition & 0 deletions src/Tasks/CmasiPointSearchTaskService.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ class CmasiPointSearchTaskService : public TaskServiceBase
bool isCalculateOption(const int64_t& taskId, int64_t& optionId, const double& wedgeHeading_rad);
private:
std::shared_ptr<afrl::cmasi::PointSearchTask> m_pointSearchTask;
int64_t m_discretizationLevel{16};

public:

Expand Down