00001 #include "vertigo/g2o/edge_switchPrior.h" 00002 using namespace std; 00003 00004 EdgeSwitchPrior::EdgeSwitchPrior() 00005 { 00006 setMeasurement(1.0); 00007 } 00008 00009 bool EdgeSwitchPrior::read(std::istream &is) 00010 { 00011 double new_measurement; 00012 is >> new_measurement; 00013 00014 setMeasurement(new_measurement); 00015 00016 is >> information()(0,0); 00017 return true; 00018 } 00019 00020 bool EdgeSwitchPrior::write(std::ostream &os) const 00021 { 00022 os << measurement() << " " << information()(0,0); 00023 return true; 00024 } 00025 00026 void EdgeSwitchPrior::setMeasurement(const double & m) 00027 { 00028 g2o::BaseEdge<1, double>::setMeasurement(m); 00029 information()(0,0) = 1.0; 00030 } 00031 00032 void EdgeSwitchPrior::linearizeOplus() 00033 { 00034 _jacobianOplusXi[0]=-1.0; 00035 } 00036 00037 void EdgeSwitchPrior::computeError() 00038 { 00039 const VertexSwitchLinear* s = static_cast<const VertexSwitchLinear*>(_vertices[0]); 00040 00041 _error[0] = measurement() - s->x(); 00042 00043 } 00044