Skip to content
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

Open
wants to merge 2 commits into
base: mazihang
Choose a base branch
from
Open

Mazihang #52

wants to merge 2 commits into from

Conversation

Fornothing4
Copy link
Collaborator

完成通信订阅功能,多开client、client终止后sever输出还未解决

time0.minute=local->tm_min;
time0.second=local->tm_sec;
client::client name;
name.request.topicname="client";
Copy link
Member

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){
Copy link
Member

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);
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在client调用服务之前无法得知topic名称,此处为错误操作

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants