I have written a ROS node to subscribe to the topics from a rosbag
`/sensors/velodyne_points
/sensors/camera/image_color
/sensors/camera/camera_info`
The `main()` function is as below
int main(int argc, char** argv)
{
ros::init(argc, argv, "lidar_calibration");
ros::NodeHandle nh;
// ROS_INFO("Starting LiDAR node");
message_filters::Subscriber image_sub(nh, "image", 1);
message_filters::Subscriber info_sub(nh, "camera_info", 1);
message_filters::Subscriber lidar_sub(nh, "velodyne_points", 1);
message_filters::TimeSynchronizer sync(image_sub, info_sub, lidar_sub, 10);
sync.registerCallback(boost::bind(&processCallback, _1, _2, _3));
ros::spin();
// cv::destroyWindow(OPENCV_WINDOW);
return 0;
}
And my ROS variables are:
ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/opt/ros/kinetic/share
ROS_MASTER_URI=http://localhost:11311
ROS_VERSION=1
ROS_MAVEN_DEPLOYMENT_REPOSITORY=/opt/ros/kinetic/share/maven
ROS_MAVEN_PATH=/opt/ros/kinetic/share/maven
ROS_HOSTNAME=localhost
ROS_MAVEN_REPOSITORY=https://github.com/rosjava/rosjava_mvn_repo/raw/master
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=kinetic
ROS_IP=localhost
ROS_HOME=/home/ak/.ros
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros
I'm able to build the code but I'm stuck with the error when I rosrun the binary
[FATAL] [1525151060.907371740]: You must call ros::init() before creating the first NodeHandle
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
[ERROR] [1525151060.944339461]: [registerPublisher] Failed to contact master at [:0]. Retrying...
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
And yes, I'm running `roscore` in another terminal and `bashrc` is sourced in every terminal session that is running.
The other posts in the forum which look similar are quite different than in my case.
Any help would be really appreciated.
Thanks
↧