Skip to content

Commit 49b3a0a

Browse files
authored
Pi trac team dev branch - mostly work for Visual Studio compile environment. (#27)
* Improvements for running PiTrac in Visual Studio * Fixes to compile better in Visual Studio
1 parent 1041897 commit 49b3a0a

File tree

5 files changed

+41
-554
lines changed

5 files changed

+41
-554
lines changed

Software/LMSourceCode/ImageProcessing/ImageProcessing.vcxproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,17 @@
130130
<ClCompile>
131131
<WarningLevel>Level3</WarningLevel>
132132
<SDLCheck>true</SDLCheck>
133-
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
133+
<PreprocessorDefinitions>BOOST_BIND_GLOBAL_PLACEHOLDERS;BOOST_ALL_DYN_LINK;BOOST_USE_WINAPI_VERSION=0x0A00;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
134134
<ConformanceMode>true</ConformanceMode>
135-
<AdditionalIncludeDirectories>E:\Dev_Libs\opencv\build\include;E:\Dev_Libs\boost_1_81_0\;E:\Dev_Libs\NumCpp-master\include;</AdditionalIncludeDirectories>
135+
<AdditionalIncludeDirectories>E:\Dev_Libs\opencv\build\include;E:\Dev_Libs\boost_1_87_0\</AdditionalIncludeDirectories>
136136
<LanguageStandard>stdcpp20</LanguageStandard>
137137
<DebugInformationFormat>OldStyle</DebugInformationFormat>
138138
</ClCompile>
139139
<Link>
140140
<SubSystem>Console</SubSystem>
141141
<GenerateDebugInformation>true</GenerateDebugInformation>
142-
<AdditionalLibraryDirectories>E:\Dev_Libs\opencv\build\x64\vc16\lib;E:\Dev_Libs\boost_1_81_0\stage\lib</AdditionalLibraryDirectories>
143-
<AdditionalDependencies>E:\Dev_Libs\opencv\build\x64\vc16\lib\*d.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
142+
<AdditionalLibraryDirectories>E:\Dev_Libs\opencv\build\x64\vc16\lib;E:\Dev_Libs\boost_1_87_0\lib64-msvc-14.3</AdditionalLibraryDirectories>
143+
<AdditionalDependencies>E:\Dev_Libs\opencv\build\x64\vc16\lib\opencv_world4100d.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
144144
</Link>
145145
</ItemDefinitionGroup>
146146
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
@@ -524,4 +524,4 @@
524524
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
525525
<ImportGroup Label="ExtensionTargets">
526526
</ImportGroup>
527-
</Project>
527+
</Project>

Software/LMSourceCode/ImageProcessing/ball_image_proc.cpp

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2704,19 +2704,24 @@ namespace golf_sim {
27042704
return rotationResult;
27052705
}
27062706

2707+
bool write_spin_analysis_CSV_files = false;
27072708

2708-
// This data export can be used for, say, Excel analysis - CSV format
2709-
std::string csv_fname_coarse = "spin_analysis_coarse.csv";
2710-
ofstream csv_file_coarse(csv_fname_coarse);
2711-
GS_LOG_TRACE_MSG(trace, "Writing CSV spin data to: " + csv_fname_coarse);
2712-
for (auto& element : comparison_csv_data)
2713-
{
2714-
// Don't use logging utility so that we don't have all the timing crap in the output
2715-
csv_file_coarse << element;
2709+
GolfSimConfiguration::SetConstant("gs_config.spin_analysis.kWriteSpinAnalysisCsvFiles", write_spin_analysis_CSV_files);
2710+
2711+
if (write_spin_analysis_CSV_files) {
2712+
// This data export can be used for, say, Excel analysis - CSV format
2713+
std::string csv_fname_coarse = "spin_analysis_coarse.csv";
2714+
ofstream csv_file_coarse(csv_fname_coarse);
2715+
GS_LOG_TRACE_MSG(trace, "Writing CSV spin data to: " + csv_fname_coarse);
2716+
for (auto& element : comparison_csv_data)
2717+
{
2718+
// Don't use logging utility so that we don't have all the timing crap in the output
2719+
csv_file_coarse << element;
2720+
}
2721+
csv_file_coarse.close();
27162722
}
2717-
csv_file_coarse.close();
27182723

2719-
// See which angle looked best and then iterate more closely near thos angles
2724+
// See which angle looked best and then iterate more closely near those angles
27202725
RotationCandidate c = candidates[maxIndex];
27212726

27222727
std::string s = "Best Coarse Initial Rotation Candidate was #" + std::to_string(maxIndex) + " - Rot: (" + std::to_string(c.x_rotation_degrees) + ", " + std::to_string(c.y_rotation_degrees) + ", " + std::to_string(c.z_rotation_degrees) + ") ";
@@ -2752,15 +2757,18 @@ namespace golf_sim {
27522757
// TBD - change CompareCandidateAngleImages to work directly with the "3D" images
27532758
maxIndex = CompareCandidateAngleImages(&ball_image2DimpleEdges, &finalOutputCandidateElementsMat, &finalOutputCandidateElementsMatSize, &finalCandidates, comparison_csv_data);
27542759

2755-
std::string csv_fname_fine = "spin_analysis_fine.csv";
2756-
ofstream csv_file_fine(csv_fname_fine);
2757-
GS_LOG_TRACE_MSG(trace, "Writing CSV spin data to: " + csv_fname_fine);
2758-
for (auto& element : comparison_csv_data)
2759-
{
2760-
// Don't use logging utility so that we don't have all the timing crap in the output
2761-
csv_file_fine << element;
2760+
if (write_spin_analysis_CSV_files) {
2761+
2762+
std::string csv_fname_fine = "spin_analysis_fine.csv";
2763+
ofstream csv_file_fine(csv_fname_fine);
2764+
GS_LOG_TRACE_MSG(trace, "Writing CSV spin data to: " + csv_fname_fine);
2765+
for (auto& element : comparison_csv_data)
2766+
{
2767+
// Don't use logging utility so that we don't have all the timing crap in the output
2768+
csv_file_fine << element;
2769+
}
2770+
csv_file_fine.close();
27622771
}
2763-
csv_file_fine.close();
27642772

27652773
// Analyze the results
27662774
int bestRotX = 0;

Software/LMSourceCode/ImageProcessing/golf_sim_config.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"kLogWebserverImagesToFile": 1,
88
"kLogDiagnosticImagesToUniqueFiles": 0,
99
"kLinuxBaseImageLoggingDir": "/home/PiTracUserName/LM_Shares/Images/",
10-
"kPCBaseImageLoggingDir": "D:\\GolfSim\\LM\\Images\\"
10+
"kPCBaseImageLoggingDir": "L:/Images/"
1111
},
1212

1313
"modes": {
@@ -68,6 +68,7 @@
6868
"kPlacedBallHoughDpParam1": 1.5,
6969
"kPlacedBallUseLargestBall": 0,
7070

71+
"Circle Refinement is not currently working - keep to 0": 0,
7172
"kUseBestCircleRefinement": 0,
7273
"kUseBestCircleLargestCircle": 0,
7374

@@ -145,6 +146,7 @@
145146

146147
"spin_analysis": {
147148

149+
"kWriteSpinAnalysisCsvFiles": 0,
148150
"kGaborMaxWhitePercent": 45,
149151
"kGaborMinWhitePercent": 39,
150152
"kCoarseXRotationDegreesIncrement": 3,
@@ -272,7 +274,7 @@
272274
},
273275

274276
"testing": {
275-
"kTwoImageTestTeedBallImage": "gs_log_img__log_ball_final_found_ball_img.png",
277+
"kTwoImageTestTeedBallImage": "log_ball_final_found_ball_img.png",
276278
"kTwoImageTestStrobedImage": "log_cam2_last_strobed_img.png",
277279

278280
"kExternallyStrobedEnvNumber_bits_for_fast_on_pulse_": 5,

Software/LMSourceCode/ImageProcessing/logging_tools.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace golf_sim {
2121

2222

2323
// Create a custom sink to save the last <n> log messages
24-
24+
/*** TBD - Not Completed yet
2525
class RecentMessageSink : public basic_formatted_sink_backend<
2626
char,
2727
combine_requirements< synchronized_feeding, flushing >::type
@@ -57,7 +57,7 @@ namespace golf_sim {
5757
5858
BOOST_LOG_API void flush() {};
5959
};
60-
60+
***/
6161

6262

6363

@@ -68,6 +68,7 @@ namespace golf_sim {
6868
bool LoggingTools::logging_tool_wait_for_keypress_ = false;
6969

7070
boost::circular_buffer<std::string> LoggingTools::RecentLogMessages(20);
71+
7172
#ifdef __unix__
7273
std::string LoggingTools::kBaseImageLoggingDir = "/mnt/VerdantShare/dev/GolfSim/LM/Images/";
7374
#else
@@ -158,6 +159,7 @@ namespace golf_sim {
158159
fsSink->locked_backend()->auto_flush(true);
159160

160161
// Add our custom recent-messages sink to the logger.
162+
/*** TBD - Not Completed yet
161163
boost::shared_ptr <RecentMessageSink> RMSink = boost::make_shared<RecentMessageSink>();
162164
163165
// Wrap it into the frontend and register in the core.
@@ -168,6 +170,8 @@ namespace golf_sim {
168170
// boost::log::sources::logger logger;
169171
boost::log::core::get()->add_sink(sink);
170172
sink->set_formatter(logFmt);
173+
***/
174+
171175
}
172176

173177
boost::circular_buffer<std::string> &LoggingTools::GetRecentLogMessagesQueue() {

0 commit comments

Comments
 (0)