how to creating fake Pose
Hello, I am trying to pubuilsh a fake pose in code. I checked the message rules and put the desired value and executed it, but the following error occurs in the subscriber. May i know what mistake i made??
Error: TF_NAN_INPUT: Ignoring transform for child_frame_id "map" from authority "unknown_publisher" because of a nan value in the transform (0.000000 0.000000 nan) (0.000000 0.000000 0.000000 1.000000)
at line 244 in /tmp/binarydeb/ros-melodic-tf2-0.6.5/src/buffer_core.cpp
Below is the code I want to run
#include "ros/ros.h"
#include "geometry_msgs/PoseStamped.h"
#include "geometry_msgs/PoseWithCovarianceStamped.h"
#include <tf/transform_broadcaster.h>
#include <iostream>
static geometry_msgs::PoseStamped rpyPose_goal;
using namespace std;
class send_Pose{
public:
// Initialize ROS publishers
ros::Publisher start_pub;
ros::Publisher goal_pub;
// Take Goal_pose as input and publish
void handle_goal_pose() {
rpyPose.header.frame_id = "map";
rpyPose.header.stamp = ros::Time::now();
rpyPose.pose.pose.position.x = (float)16.9677391052;
rpyPose.pose.pose.position.y = (float)6.06961250305;
rpyPose.pose.pose.position.z = (float)0;
rpyPose.pose.pose.orientation.x = (float)0;
rpyPose.pose.pose.orientation.y = (float)0;
rpyPose.pose.pose.orientation.z = (float)0.683183893935;
rpyPose.pose.pose.orientation.w = (float)0.730246374224;
start_pub.publish(rpyPose);
ROS_INFO("SUCCESS!");
}
};
int main(int argc, char **argv) {
ros::init(argc, argv, "rviz_click_to_2d");
ros::NodeHandle node;
send_Pose send_pose;
send_pose.goal_pub = node.advertise<geometry_msgs::PoseStamped>("/move_base_simple/goal", 1);
send_pose.handle_start_pose();
send_pose.handle_goal_pose();
ros::Rate loop_rate(10);
while (ros::ok()) {
ros::spinOnce();
loop_rate.sleep();
}
return 0;
}