本文整理汇总了C++中Sensor::parameter方法的典型用法代码示例。如果您正苦于以下问题:C++ Sensor::parameter方法的具体用法?C++ Sensor::parameter怎么用?C++ Sensor::parameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sensor
的用法示例。
在下文中一共展示了Sensor::parameter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeQueue
void writeQueue() {
SensorData* data;
std::ofstream ofG2O(&filename[0]);
geometry_msgs::TransformStamped msg;
int num = 0;
// this is the vertex where we are packing the data
g2o::VertexSE3* activeVertex = 0;
// this is the timestamp of the first measurement added to the vertex
double activeVertexTime=0;
// this is the previous vertex
g2o::VertexSE3* previousVertex = 0;
// this is the timestamp of the first measurement added to the previous vertex
double previousVertexTime=0;
// the last position of the robot (not of the vertex, needed to measure the distances)
Eigen::Isometry3d lastRobotPose;
// set of sensors we packed in the current data.
// We do not want to put 10 camera images of the same camera in the same vertex.
std::set<Sensor*> addedSensors;
Eigen::Vector2d distances(0.,0);
while (true)
{
if(! _queue.empty())
{
data = (SensorData*)_queue.front();
double timeNow = _queue.lastElementTime();
conditionalPrint(annoyingLevel) << "size=" << _queue.size() << " lastTime=" << FIXED(timeNow) << endl;
if (timeNow - data->timeStamp()> initialDelay)
{ // we have enough stuff in the queue
_queue.pop_front();
if (! nptr->ok())
continue;
tf::StampedTransform transform;
bool we_got_transf = false;
try
{
ros::Time timeStamp;
// Get transformation
(*tfListener).lookupTransform("/odom", "/base_link", timeStamp.fromSec(data->timeStamp()), transform);
we_got_transf = true;
}
catch (tf::TransformException & ex)
{
ROS_ERROR("%s", ex.what());
}
if (! we_got_transf)
continue;
Eigen::Isometry3d currentRobotPose = fromStampedTransform(transform);
double currentDataTime = data->timeStamp();
distances += isometry2distance(lastRobotPose.inverse()*currentRobotPose);
double passedTime = currentDataTime-previousVertexTime;
lastRobotPose = currentRobotPose;
conditionalPrint(annoyingLevel) << "distances: " << distances[0] << " " << distances[1] << " " << passedTime << endl;
if (distances[0] < minDistances[0] &&
distances[1] < minDistances[1] &&
passedTime < minTime){
conditionalPrint(annoyingLevel) << "reject: (time/distance)" << endl;
// SKIP THE FRAME
delete data;
data = 0;
continue;
}
if (!activeVertex) {
activeVertex = new g2o::VertexSE3();
activeVertex->setId(num);
activeVertex->setEstimate(fromStampedTransform(transform));
activeVertexTime = currentDataTime;
}
Sensor* sensor = data->sensor();
assert (sensor && "!");
// check if we already packed the data for this kind of sensor
if (addedSensors.count(sensor)){
conditionalPrint(annoyingLevel) << "reject: (sensor) "<< endl;
delete data;
} else {
addedSensors.insert(sensor);
Parameter* parameter = sensor->parameter();
assert (parameter && "[email protected]#");
//data->writeOut(filename);
if (! graph->parameters().getParameter(parameter->id())){
graph->parameters().addParameter(parameter);
graph->saveParameter(ofG2O, parameter);
}
activeVertex->addUserData(data);
data->setDataContainer(activeVertex);
}
// detach the data from the thing
//.........这里部分代码省略.........