ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

reverse3D's profile - activity

2018-09-03 08:56:49 -0500 received badge  Famous Question (source)
2018-05-02 01:09:04 -0500 received badge  Notable Question (source)
2018-05-01 04:44:38 -0500 commented answer TimeSynchronizer in a class using stereo input

I'm facing almost a similar problem. In this case what would be the correct way to declare and define the message_filter

2018-05-01 04:08:11 -0500 marked best answer Couldn't find an AF_INET address of []

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

Some excerpts from the code below:

// ROS includes
#include <ros/ros.h>
#include <ros/console.h>
...

// OpenCV includes
...

// Include pcl
...

// Include PointCloud2 ROS message
...

static const std::string OPENCV_WINDOW = "Image window";
const tf::TransformListener tf_listener_;
image_geometry::PinholeCameraModel cam_model_;
tf::StampedTransform transform;
std::vector <tf::Vector3> objectPoints;
tf::Vector3 pt_cv;
std::vector <cv::Point3d> pt_transformed;

void processCallback(const sensor_msgs::ImageConstPtr& image_msg,
    const sensor_msgs::CameraInfoConstPtr& info_msg,
    const sensor_msgs::PointCloud2ConstPtr& pointCloudMsg)
{
    ...
}
int main(int argc, char** argv) 
{
ros::init(argc, argv, "lidar_calibration");

ros::NodeHandle nh;
// ROS_INFO("Starting LiDAR node");

message_filters::Subscriber<sensor_msgs::Image> image_sub(nh, "image", 1);
message_filters::Subscriber<sensor_msgs::CameraInfo> info_sub(nh, "camera_info", 1);
message_filters::Subscriber<sensor_msgs::PointCloud2> lidar_sub(nh, "velodyne_points", 1);
message_filters::TimeSynchronizer<sensor_msgs::Image, sensor_msgs::CameraInfo, sensor_msgs::PointCloud2> 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

2018-05-01 04:08:11 -0500 received badge  Scholar (source)
2018-05-01 04:07:49 -0500 received badge  Popular Question (source)
2018-05-01 03:28:46 -0500 commented question Couldn't find an AF_INET address of []

@gvdhoorn You are right. That was the problem. I somehow overlooked it. Thanks

2018-05-01 03:10:12 -0500 commented question Couldn't find an AF_INET address of []

No there are none with ros as global variables. This pastebin has the complete code

2018-05-01 02:40:31 -0500 asked a question Couldn't find an AF_INET address of []

Couldn't find an AF_INET address of [] I have written a ROS node to subscribe to the topics from a rosbag /sensors/velo

2018-04-29 00:34:38 -0500 received badge  Enthusiast
2017-07-10 23:26:27 -0500 received badge  Supporter (source)