Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00016 #include <ros/ros.h>
00017 #include <std_msgs/Float64MultiArray.h>
00018 #include <stdlib.h>
00019
00020 int main(int argc, char **argv) {
00021 if (argc < 3) {
00022 std::cerr << "Usage: " << argv[0] << "<topic> <u1> <u2> ... <un>" << std::endl;
00023 exit(0);
00024 }
00025 std::string topic(argv[1]);
00026
00027 ros::init(argc, argv, "setVehicleActuators");
00028 ros::NodeHandle nh;
00029
00030 ros::Publisher u_pub;
00031 u_pub=nh.advertise<std_msgs::Float64MultiArray>(topic,1);
00032 ros::Rate rate(5);
00033
00034 double u[argc-2];
00035 for (int i=2; i<argc; i++) u[i-2]=atof(argv[i]);
00036
00037 while (ros::ok()) {
00038 std_msgs::Float64MultiArray um;
00039
00040 for (int i=0; i<argc-2; i++)
00041 um.data.push_back(u[i]);
00042
00043 u_pub.publish(um);
00044
00045 ros::spinOnce();
00046 rate.sleep();
00047 }
00048
00049 return 0;
00050 }