35 #include <boost/interprocess/sync/scoped_lock.hpp> 42 #include <mrpt/version.h> 46 int main(
int argc,
char** argv)
81 const std::string& source_frame,
const ros::Time& time,
89 "debug: waitForTransform(): target_frame='%s' " 91 target_frame.c_str(), source_frame.c_str());
94 target_frame, source_frame, time, polling_sleep_duration);
96 target_frame, source_frame, time, transform);
101 "Failed to get transform target_frame (%s) to source_frame (%s)",
102 target_frame.c_str(), source_frame.c_str());
114 std::string odom_frame_id =
141 if (
getStaticTF(_msg.header.frame_id, sensor_pose_on_robot))
162 if (
getStaticTF(_msg.header.frame_id, sensor_pose_on_robot))
181 ROS_INFO(
"Problem to syn data for sensor frame!");
184 auto odometry = CObservationOdometry::Create();
188 CObservation2DRangeScan::Ptr range_scan;
189 CObservationBearingRange::Ptr bearing_range;
190 CObservationBeaconRanges::Ptr beacon_range;
201 range_scan = CObservation2DRangeScan::Create();
215 bearing_range = CObservationBearingRange::Create();
228 beacon_range = CObservationBeaconRanges::Create();
233 static std::shared_ptr<mrpt::poses::CPose2D> lastOdomPose;
236 lastOdomPose = std::make_shared<mrpt::poses::CPose2D>();
237 *lastOdomPose = odometry->odometry;
243 odom_move.timestamp = odometry->timestamp;
245 auto action = CActionCollection::Create();
246 action->insert(odom_move);
249 auto sf = CSensoryFrame::Create();
252 CObservation::Ptr obs_range_scan = CObservation::Ptr(range_scan);
253 sf->insert(obs_range_scan);
258 CObservation::Ptr obs_bearing_range = CObservation::Ptr(bearing_range);
259 sf->insert(obs_bearing_range);
263 CObservation::Ptr obs_bearing_range = CObservation::Ptr(beacon_range);
264 sf->insert(obs_bearing_range);
268 *lastOdomPose = odometry->odometry;
276 std::string target_frame_id =
278 std::string source_frame_id = source_frame;
279 std::string key = target_frame_id +
"->" + source_frame_id;
289 "debug: updateLaserPose(): target_frame_id='%s' " 290 "source_frame_id='%s'",
291 target_frame_id.c_str(), source_frame_id.c_str());
294 target_frame_id, source_frame_id,
ros::Time(0), transform);
297 pose.
x() = translation.
x();
298 pose.
y() = translation.
y();
299 pose.z() = translation.
z();
302 for (
int c = 0;
c < 3;
c++)
307 "Static tf '%s' with '%s'", key.c_str(),
unsigned int sync_attempts_sensor_frame_
double bearing_range_std_pitch
mrpt::system::TTimeStamp timestamp
void addObservationMemoryReference(const CObservationPtr &observation)
mrpt::obs::CObservationBearingRange::Ptr last_bearing_range_
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void addActionsMemoryReference(const CActionCollectionPtr &action)
bool getStaticTF(std::string source_frame, mrpt::poses::CPose3D &des)
mrpt::system::TTimeStamp now()
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void callbackLaser(const sensor_msgs::LaserScan &)
double sensor_frame_sync_threshold
int main(int argc, char **argv)
bool waitForTransform(mrpt::poses::CPose3D &des, const std::string &target_frame, const std::string &source_frame, const ros::Time &time, const ros::Duration &timeout, const ros::Duration &polling_sleep_duration=ros::Duration(0.01))
double bearing_range_std_range
GLuint GLenum GLenum transform
ros::Subscriber subOdometry_
ROSCPP_DECL void spin(Spinner &spinner)
TFSIMD_FORCE_INLINE const Vector3 & getRow(int i) const
mrpt::poses::CPose2D odometry
std::string resolve(const std::string &prefix, const std::string &frame_name)
CActionRobotMovement2D::TMotionModelOptions motionModelOptions
TFSIMD_FORCE_INLINE const tfScalar & x() const
std::string odom_frame_id
TFSIMD_FORCE_INLINE const tfScalar & z() const
mrpt::obs::CObservation2DRangeScan::Ptr last_range_scan_
std::string base_frame_id
double bearing_range_std_yaw
TFSIMD_FORCE_INLINE const tfScalar & y() const
void convert(const nav_msgs::Odometry &src, mrpt::obs::CObservationOdometry &des)
tf::TransformListener listenerTF_
void convert(const ros::Time &src, mrpt::system::TTimeStamp &des)
std::map< std::string, mrpt::poses::CPose3D > static_tf_
void addObservation(const ros::Time &time)
void asString(std::string &s) const
void updateRawLogName(const mrpt::system::TTimeStamp &t)
void addObservationsMemoryReference(const CSensoryFramePtr &observations)
GLdouble GLdouble GLdouble r
void callbackOdometry(const nav_msgs::Odometry &)
mrpt::obs::CObservationBeaconRanges::Ptr last_beacon_range_
mrpt::obs::CObservationOdometry::Ptr last_odometry_
ros::Subscriber subLaser_
double BASE_IMPEXP timeDifference(const mrpt::system::TTimeStamp t_first, const mrpt::system::TTimeStamp t_later)
void computeFromOdometry(const mrpt::poses::CPose2D &odometryIncrement, const TMotionModelOptions &options)
RawlogRecordNode(ros::NodeHandle &n)
void callbackMarker(const marker_msgs::MarkerDetection &)
void setRotationMatrix(const mrpt::math::CMatrixDouble33 &ROT)
bool record_bearing_range
ros::Subscriber subMarker_