Skip to content

What410802/Task_03

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README for Task_03 of XJTU DXRMV

Code files explanation

There are 3 C++ code files in src/.

  • trajectory_common.hpp: The header file used by both .cpp file. Provides some basic definitions and configurations for the two code files below. This header exists to provide tidiness, avoiding writing the shared configurations separately and repeatedly in the two code files.
  • main.cpp: The main program code to read the original video, extract the trajectory, fit parameters required in the task, and save these parameters to output/trajectory_result.csv.
  • verify_plot.cpp: The code to verify the fitting result by plotting the fitted trajectory in the original video after reading the results stored in output/trajectory_result.csv, and save it to output/trajectory_result.mp4.

Results

  • output/trajectory_result.csv: Parameters of the fitted model, including $v_{x0}, v_{y0}, g, k$.

  • output/trajectory_result.mp4: The fitted trajectory video. Can be opened with VLC Media Player.

  • output/trajectory_command_line.txt: Full command line outputs of time ./main and time ./verify_draw. Screenshots are as follows:

    Screenshot 1 Screenshot 2

Encountered problems and thoughts

  1. Misunderstanding the usage of template parameters for the auto-differentiation Functor. The correct usage is detailed in the official documentation 1.
  2. Formula error: A minor error existed in the formula for calculating each coordinate point. However, this bug took hours to identify due to its extreme subtlety, making it difficult to detect initially.

Of the two issues above, the first one is easier to spot and is finally solved by looking up in the official documents; the second one is harder to find out, but was fixed in seconds.

Efficiency improvements:

  • Pre-allocating memory for std::vectors using reserve.
  • Making functions inline at where performance is critical.
  • Un-sync std::cin, std::cout with stdio, because no C-style IO is used.

Footnotes

  1. Ceres AutoDiffCostFunction: http://ceres-solver.org/nnls_modeling.html#_CPPv4N5ceres20AutoDiffCostFunctionE

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published