33 SensorLine3D::SensorLine3D(
const std::string& name_): BinarySensor<
Robot3D, EdgeSE3Line3D,
WorldObjectLine3D>(name_) {
35 _information.setIdentity();
38 setInformation(_information);
41 bool SensorLine3D::isVisible(SensorLine3D::WorldObjectType* to){
42 if (! _robotPoseObject)
44 assert(to && to->vertex());
45 VertexType* v=to->vertex();
46 VertexType::EstimateType pose=v->estimate();
47 VertexType::EstimateType delta = _sensorPose.inverse()*pose;
48 Vector3d translation=delta;
49 double range2=translation.squaredNorm();
54 translation.normalize();
56 double bearing=acos(translation.z());
57 if (fabs(bearing)>
_fov)
62 void SensorLine3D::addParameters(){
64 _offsetParam =
new ParameterSE3Offset();
66 world()->addParameter(_offsetParam);
69 void SensorLine3D::addNoise(EdgeType* e){
70 EdgeType::ErrorVector n=_sampler.generateSample();
71 e->setMeasurement(e->measurement()+n);
72 e->setInformation(information());
75 void SensorLine3D::sense() {
80 RobotType* r=
dynamic_cast<RobotType*
>(robot());
81 std::list<PoseObject*>::reverse_iterator it=r->trajectory().rbegin();
83 while (it!=r->trajectory().rend() && count < 1){
84 if (!_robotPoseObject)
85 _robotPoseObject = *it;
89 if (!_robotPoseObject)
91 _sensorPose = _robotPoseObject->vertex()->estimate()*_offsetParam->offset();
92 for (std::set<BaseWorldObject*>::iterator it=world()->objects().begin();
93 it!=world()->objects().end(); it++){
94 WorldObjectType* o=
dynamic_cast<WorldObjectType*
>(*it);
95 if (o && isVisible(o)){
96 EdgeType* e=mkEdge(o);
97 e->setParameterId(0,_offsetParam->id());
100 e->setMeasurementFromState();
WorldObject< VertexLine3D > WorldObjectLine3D
Protocol The SLAM executable accepts such as solving the and retrieving or vertices in the graph
Robot< WorldObjectSE3 > Robot3D