46 #include <visualization_msgs/Marker.h> 48 #include "fiducial_msgs/Fiducial.h" 49 #include "fiducial_msgs/FiducialArray.h" 50 #include "fiducial_msgs/FiducialTransform.h" 51 #include "fiducial_msgs/FiducialTransformArray.h" 55 #include <opencv2/calib3d.hpp> 56 #include <opencv2/highgui.hpp> 71 void transformCallback(
const fiducial_msgs::FiducialTransformArray::ConstPtr &msg);
79 vector<Observation> observations;
81 for (
size_t i = 0; i < msg->transforms.size(); i++) {
82 const fiducial_msgs::FiducialTransform &ft = msg->transforms[i];
84 tf2::Vector3 tvec(ft.transform.translation.x, ft.transform.translation.y,
85 ft.transform.translation.z);
87 tf2::Quaternion q(ft.transform.rotation.x, ft.transform.rotation.y, ft.transform.rotation.z,
88 ft.transform.rotation.w);
91 if (use_fiducial_area_as_weight) {
92 variance = weighting_scale / ft.fiducial_area;
94 variance = weighting_scale * ft.object_error;
99 msg->header.stamp, msg->header.frame_id));
100 observations.push_back(obs);
103 fiducialMap.update(observations, msg->header.stamp);
121 auto node = unique_ptr<FiducialSlam>(
nullptr);
124 if (
node !=
nullptr)
node->fiducialMap.saveMap();
133 node = make_unique<FiducialSlam>(nh);
140 node->fiducialMap.update();
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool use_fiducial_area_as_weight
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
FiducialSlam(ros::NodeHandle &nh)
void mySigintHandler(int sig)
int main(int argc, char **argv)
ROSCPP_DECL void shutdown()
ROSCPP_DECL void spinOnce()
void transformCallback(const fiducial_msgs::FiducialTransformArray::ConstPtr &msg)