Robotics StackExchange | Archived questions

Getting boolean data from a sensor in labview to ROS

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.

Asked by rusman96 on 2019-10-08 03:24:29 UTC

Comments

Answers