fake_volt_pub.cpp
Go to the documentation of this file.
00001 #include "ros/ros.h"
00002 #include "std_msgs/String.h"
00003 #include "sensor_msgs/BatteryState.h"
00004 #include <sstream>
00005 
00006 int main(int argc, char **argv){
00007   ros::init(argc, argv, "talker");
00008   ros::NodeHandle n;
00009   ros::Publisher chatter_pub = n.advertise<sensor_msgs::BatteryState>("/battery0", 1);
00010   ros::Rate loop_rate(10);
00011 
00012   int count = 0;
00013   while (ros::ok()){
00014     sensor_msgs::BatteryState stat;
00015     stat.voltage = 10.9;
00016     chatter_pub.publish(stat);
00017     ros::spinOnce();
00018 
00019     loop_rate.sleep();
00020   }
00021   return 0;
00022 }


segbot_sensors
Author(s): Piyush Khandelwal
autogenerated on Thu Jun 6 2019 21:37:13