Commit f58890bc authored by henryjandrew's avatar henryjandrew

fixed bugs in UrbanTrajectory, and added motion to the source

parent 4bbb06a3
......@@ -71,11 +71,15 @@ int main( int iNumInArgs, char* pcInArgs[] )
return 255;
}
// Generate trajectory
float start_pos_x = 0.0f;
float start_pos_y = -46.5f;
float start_pos_z = 1.0f;
// Scene
//auto pReceiver = make_shared< CSensor >( VistaVector3D( 10.0f, 5.0f, 1.7f ) );
auto pReceiver = make_shared< CSensor >(VistaVector3D(15.0f, 0.0f, 1.7f));
auto pReceiver = make_shared< CSensor >( VistaVector3D( 10.0f, 5.0f, 1.7f ) );
auto pVehicle = make_shared< CEmitter >( VistaVector3D( -1.0f, 20.f, 1.0f ) );
auto pVehicle = make_shared< CEmitter >(VistaVector3D(start_pos_x, start_pos_y, start_pos_z));
// Configuration
......@@ -99,18 +103,30 @@ int main( int iNumInArgs, char* pcInArgs[] )
const int iMaxCombinedOrder = 4;
// Generate trajectory
//calculate how many time frames to calculate, and how far to move the source between each timeframe
int blockLength = 128;
int sampleRate = 44100;
float speed = 30.0f * 1000.0f / (60.0f * 60.0f); //speed in m/s
float total_y_distance = 100.0f;
float simulation_time = total_y_distance / speed; //time the car takes to move the simulated distance
int total_simulated_samples = (int)ceil(sampleRate * simulation_time); //total number of samples throughout the simulation
int total_simulated_blocks = (int)ceil(total_simulated_samples / (float)blockLength); //total number of blocks/ updated in the simulation
float increment_y = total_y_distance / (float)total_simulated_blocks; //how much to increment y each time (+1 to account for starting pos)
ITAStopWatch sw;
int iNumSteps = 10; // @todo henry: determine number of spatial samples
for( int i = 0; i < iNumSteps; i++ )
int iNumSteps = total_simulated_blocks;
for( int i = 0; i <= iNumSteps; i++ )
{
sw.start();
cout << "\t --- \t Simulating frame " << std::setw( 5 ) << i+1 << " of " << iNumSteps << " #### " << endl;
pVehicle->vPos = pVehicle->vPos + VistaVector3D( 0.01f, 0.0f, 0.0f ); // Move source ... adjust for requested speed @henry.
cout << "\t --- \t Simulating frame " << std::setw( 5 ) << i << " of " << iNumSteps << " #### " << endl;
//pVehicle->vPos = pVehicle->vPos + VistaVector3D( 0.01f, 0.0f, 0.0f );
if ( i > 0 )
pVehicle->vPos = pVehicle->vPos + VistaVector3D(0.0f, increment_y, 0.0f);
auto pPathEngine = make_shared<CombinedModel::CPathEngine>();
pPathEngine->Configure( bOnlyNeighbouredEdgeDiffraction, bDiffractionOnlyIntoShadowedEdges, bFilterNotVisiblePathsBetweenEdges, bFilterNotVisiblePointToEdge, bFilterNotVisiblePointToEdge, bFilterNotVisiblePaths, iNumIterations, fIntersectionTestResolution );
......@@ -125,7 +141,10 @@ int main( int iNumInArgs, char* pcInArgs[] )
cout << "Visible paths: " << to_string( oPathList.size() ) << endl;
std::stringstream ss;
ss << sOutputDirectory << "/" << "UrbanTrajectory_pps_" << std::setw( 5 ) << std::setfill( '0' ) << i+1 << ".json";
//ss << sOutputDirectory << "/" << "UrbanTrajectory_pps_" << std::setw( 5 ) << std::setfill( '0' ) << i+1 << ".json";
int n0_characters = (int)floor(log10(iNumSteps)) + 1;
ss << sOutputDirectory << "/" << "UrbanTrajectory_pps_" << std::setfill('0') << std::setw(n0_characters) << i << ".json";
oPathList.Store( ss.str().c_str() );
cout << "Done in " << timeToString( sw.stop() ) << " seconds." << endl;
......
......@@ -21,7 +21,6 @@
#include <ITAStopWatch.h>
#include <ITAStringUtils.h>
#include <ITAPropagationModels/include/ITAPropagationModels/FilterEngine.h>
#include <ITABaseDefinitions.h>
#include <ITAPropagationPathSim/UrbanEngine/UrbanImageSource.h>
......
......@@ -21,7 +21,6 @@
#include <ITAStopWatch.h>
#include <ITAStringUtils.h>
#include <ITAPropagationModels/include/ITAPropagationModels/FilterEngine.h>
#include <ITABaseDefinitions.h>
#include <ITAPropagationPathSim/BaseEngine/BaseImageSource.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment