-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mazihang #52
base: mazihang
Are you sure you want to change the base?
Mazihang #52
Conversation
time0.minute=local->tm_min; | ||
time0.second=local->tm_sec; | ||
client::client name; | ||
name.request.topicname="client"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该从ros中获取当前节点名称,否则会发生冲突
#include <iostream> | ||
#include <string> | ||
|
||
void print_message(const client::time::ConstPtr& time){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
所有ros回调函数应该以callback或CB结尾
|
||
ros::NodeHandle n; | ||
|
||
ros::Publisher pub=n.advertise<client::time>("client",1000); | ||
ros::Publisher pub=n.advertise<client::time>("client", 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
运行多个client会发布在同一个topic上,无法执行
|
||
ros::NodeHandle n; | ||
ros::ServiceServer service = n.advertiseService("client" , log_in); | ||
ros::Subscriber sub = n.subscribe("client" , 1000 , print_message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在client调用服务之前无法得知topic名称,此处为错误操作
完成通信订阅功能,多开client、client终止后sever输出还未解决