Quiz1 Subscriber fail to pass

So far I achieved 7/10 of Quiz1 for failing to subscribe to /kobuki/laser/scan However, I do have a subscriber to that topic in my cpp file. And rostopic info /kobuki/laser/scan did display a subscriber to it.

I can not tell what is going wrong with my subscriber part.
This is my main function:

int main(int argc, char **argv) {

ros::init(argc, argv, “topics_quiz_node”);

ros::NodeHandle nh;

pub = nh.advertise<geometry_msgs::Twist>(“cmd_vel”, 1000);

ros::Subscriber sub = nh.subscribe("/kobuki/laser/scan", 1000, avoid_wall);

ros::spin();

return 0;

}

Hi @rongjin980704 , regarding the setup for your subscriber in main, everything looks fine. It’s the name of your node that’s causing the failure, you have a slight typo. Based off the picture you provided, your node name is topic_quiz_node, but the directions state it should be named topics_quiz_node (notice the extra ‘s’). If only there was a place to specify the name of your node???

1 Like

Thanks a lot! It turns out I got a typo in my launch file.

2 Likes