0
$\begingroup$

Rosanswers logo

Hello Here is what I'm trying to : I'm using an rplidar, arduino connected to Raspberry with ROS kinetic, to do autonomous mapping and navigation.

First, i run the rplidar with

roslaunch rplidar_ros view_rplidar.launch

then , slam mapping with

roslaunch rplidar_ros view_slam.launch

then I used hector_exploration with

roslaunch hector_exploration_node exploration_planner.launch

Final, to publish the cmd_vel topic I run

rosrun hector_exploration_controller simple_exploration_controller

My question, when I try to send cmd_vel values to Arduino through this code below

#include <ArduinoHardware.h>
#include <ros.h>
#include <geometry_msgs/Twist.h>

ros::NodeHandle nh;

geometry_msgs::Twist msg;

ros::Publisher pub("cmd_vel", &msg);

void setup()
{
 nh.initNode();
 nh.advertise(pub);
} void loop()
{

pub.publish(&msg);
nh.spinOnce();
}

Once I run this code on arduino, my rplidar stop spinning and give me this error message

[ WARN] [1532545086.000125786]: Shutdown request received.
[ WARN] [1532545086.000656149]: Reason given for shutdown: [new node registered with same name]

Originally posted by [email protected] on ROS Answers with karma: 35 on 2018-07-25

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Node names need to be unique. You have more than one node with the same name. Make sure that every node name is unique and you won't get this behavior.


Originally posted by jayess with karma: 6155 on 2018-07-25

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by [email protected] on 2018-07-25:
Make sense, in this case the only node should be cmd_vel since everything working fine before running the arduino code ? If so, how can I change the node name and send to arduino in the same time ??

Comment by jayess on 2018-07-25:
It depends on which nodes are giving you trouble. The full error should say what the name of the node is.

Comment by jayess on 2018-07-26:
@[email protected] if this answered your question, please click on the check mark to mark this answer as correct.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.