debugTopics.cpp
Go to the documentation of this file.
1 #include "ros/ros.h"
2 //#include "xbot_msgs/Power.h"
3 //#include "xbot_msgs/CloudCamera.h"
4 //#include "xbot_msgs/Lift.h"
5 #include "geometry_msgs/Twist.h"
6 
7 int main(int argc, char **argv)
8 {
9  ros::init(argc, argv, "debugTopics");
10  ros::NodeHandle nh;
11 // ################## debug power enable ################
12 // ros::Publisher chatter_pub = nh.advertise<xbot_msgs::Power>("/mobile_base/commands/power", 10);
13 // ros::Rate loop_rate(10);
14 // for(int i=0;i<4;i++){
15 // xbot_msgs::Power msg;
16 // msg.header.stamp = ros::Time::now();
17 // msg.power = xbot_msgs::Power::ON;
18 // chatter_pub.publish(msg);
19 // ros::spinOnce();
20 // loop_rate.sleep();
21 
22 // }
23 // ################## debug cloud camera ################
24 // ros::Publisher chatter_pub = nh.advertise<xbot_msgs::CloudCamera>("/mobile_base/commands/cloud_camera", 10);
25 // ros::Rate loop_rate(10);
26 // for(int i=0;i<4;i++){
27 // xbot_msgs::CloudCamera msg;
28 // msg.header.stamp = ros::Time::now();
29 // msg.cloud_degree = 60;
30 // msg.camera_degree = 135;
31 // chatter_pub.publish(msg);
32 // ros::spinOnce();
33 // loop_rate.sleep();
34 // }
35 
36 // ################## debug odom ################
37  ros::Publisher chatter_pub = nh.advertise<geometry_msgs::Twist>("/mobile_base/commands/velocity", 10);
38  ros::Rate loop_rate(1);
39  for(int i=0;i<40;i++){
40  geometry_msgs::Twist msg;
41  msg.linear.x = i*0.01;
42  msg.angular.z = i*0.01;
43  chatter_pub.publish(msg);
44  ros::spinOnce();
45  loop_rate.sleep();
46  }
47 
48 
49 
50 
51  return 0;
52 }
int main(int argc, char **argv)
Definition: debugTopics.cpp:7
msg
void publish(const boost::shared_ptr< M > &message) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ROSCPP_DECL void spinOnce()


xbot_node
Author(s): Roc, wangpeng@droid.ac.cn
autogenerated on Sat Oct 10 2020 03:28:13