Added a simplified robotics example for DynamicAutoDiffCostFunction.

Change-Id: I9520e0a9a8d9743285c5114523fbafa6ffa5b0bd
This commit is contained in:
Joydeep Biswas
2014-04-22 10:40:47 -04:00
parent cc9d3bba10
commit 8e0991381e
4 changed files with 386 additions and 19 deletions
+1 -19
View File
@@ -37,6 +37,7 @@
#include "Eigen/Core"
#include "ceres/rotation.h"
#include "glog/logging.h"
#include "random.h"
namespace ceres {
namespace examples {
@@ -44,25 +45,6 @@ namespace {
typedef Eigen::Map<Eigen::VectorXd> VectorRef;
typedef Eigen::Map<const Eigen::VectorXd> ConstVectorRef;
inline double RandDouble() {
double r = static_cast<double>(rand());
return r / RAND_MAX;
}
// Box-Muller algorithm for normal random number generation.
// http://en.wikipedia.org/wiki/Box-Muller_transform
inline double RandNormal() {
double x1, x2, w;
do {
x1 = 2.0 * RandDouble() - 1.0;
x2 = 2.0 * RandDouble() - 1.0;
w = x1 * x1 + x2 * x2;
} while ( w >= 1.0 || w == 0.0 );
w = sqrt((-2.0 * log(w)) / w);
return x1 * w;
}
template<typename T>
void FscanfOrDie(FILE* fptr, const char* format, T* value) {
int num_scanned = fscanf(fptr, format, value);