ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Hi,
I finally found a solution. It took me so long before finding these documentations so helpfull: PoseArray.h and geometry_msgs::PoseArray_< ContainerAllocator > Struct Template Reference
And with that I discover somes functions that I could use to solve my problem. I just add one line :
2 | No.2 Revision |
Hi,
I finally found a solution. It took me so long before finding these documentations so helpfull: PoseArray.h and geometry_msgs::PoseArray_< ContainerAllocator > Struct Template Reference
And with that I discover somes functions that I could use to solve my problem. I just add one line made this modifications :
// Callback which will save the estimated local position of the Apriltag
//geometry_msgs::PoseArray APtag_est_pos;
void APtag_est_pos_cb(const geometry_msgs::PoseArray::ConstPtr& AP_est_pos){
//ROS_INFO("CALLBACK AP");
APtag_est_pos = *AP_est_pos;
int n_AP = 0; // Or you can use it as a global variable
n_AP = AP_est_pos->poses.size();
ROS_INFO("n=%d", n_AP);
if(n_AP>0){
ROS_INFO("APtag est pos=[%f, %f, %f]", AP_est_pos->poses[0].position.x,
AP_est_pos->poses[0].position.y,
AP_est_pos->poses[0].position.z);
}
}
Now it's working even with 2,3 AP detected. With the variable n_AP
, you can switch between AP.
I hope it could be helpful for others to not wasting time searching so simple thing...
Best regards.
3 | No.3 Revision |
Hi,
I finally found a solution. It took me so long before finding these documentations so helpfull: PoseArray.h and geometry_msgs::PoseArray_< ContainerAllocator > Struct Template Reference
And with With that I discover somes some functions that I could use to solve my problem. I just made this modifications :
// Callback which will save the estimated local position of the Apriltag
//geometry_msgs::PoseArray APtag_est_pos;
void APtag_est_pos_cb(const geometry_msgs::PoseArray::ConstPtr& AP_est_pos){
//ROS_INFO("CALLBACK AP");
APtag_est_pos = *AP_est_pos;
int n_AP = 0; // Or you can use it as a global variable
n_AP = AP_est_pos->poses.size();
ROS_INFO("n=%d", n_AP);
if(n_AP>0){
ROS_INFO("APtag est pos=[%f, %f, %f]", AP_est_pos->poses[0].position.x,
AP_est_pos->poses[0].position.y,
AP_est_pos->poses[0].position.z);
}
}
Now it's working even with 2,3 AP detected. With the variable n_AP
, you can switch between AP.
I hope it could be helpful for others to not wasting time searching so simple thing...
Best regards.
4 | No.4 Revision |
Hi,
I finally found a solution. It took me so long before finding these documentations so helpfull: PoseArray.h and geometry_msgs::PoseArray_< ContainerAllocator > Struct Template Reference
With that I discover some functions that I could use to solve my problem. I just made this modifications :
// Callback which will save the estimated local position of the Apriltag
//geometry_msgs::PoseArray APtag_est_pos;
void APtag_est_pos_cb(const geometry_msgs::PoseArray::ConstPtr& AP_est_pos){
//ROS_INFO("CALLBACK AP");
APtag_est_pos = *AP_est_pos;
int n_AP = 0; // Or you can use it as a global variable
n_AP = AP_est_pos->poses.size();
ROS_INFO("n=%d", n_AP);
if(n_AP>0){
ROS_INFO("APtag est pos=[%f, %f, %f]", AP_est_pos->poses[0].position.x,
AP_est_pos->poses[0].position.y,
AP_est_pos->poses[0].position.z);
}
}
Now it's working even with 2,3 AP detected. With the variable n_AP
, you can switch between AP.AP by using poses[n_AP-1]
but don't forget to check there is one otherwise you will go in a wrong memory space.
I hope it could be helpful for others to not wasting time searching so simple thing...
Best regards.