Getting boolean data from a sensor in labview to ROS

asked 2019-10-08 03:24:29 -0500

rusman96 gravatar image

updated 2019-10-08 03:40:36 -0500

gvdhoorn gravatar image

i'm trying to read the boolean value that is generated by a sensor in labview onto a ROS system running a subscriber code.

The code for the subscribe is mentioned below:

#include "ros/ros.h"
#include "std_msgs/String.h"
#include "std_msgs/Bool.h"

void ROS_DATA(const std_msgs::Bool::ConstPtr& msg)
{
  ROS_INFO("I heard: [%s]", msg->data ? "true" : "false");
}

int main(int argc, char **argv)
{
  ros::init(argc, argv, "BumperControl");
  ros::NodeHandle n;
  ros::Subscriber sub = n.subscribe("bool", 1000, ROS_DATA);
  ros::spin();
  return 0;
}

When i try to run the VI on labview it keeps asking me the IP address for the ros master, i enter the correct IP and the port for the ROS master it still asks for the same thing. Is there any solution to this.

edit retag flag offensive close merge delete