ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Problem with subscriber on Chipkit [closed]

asked 2015-08-05 14:50:01 -0500

cjusto gravatar image

Hi. I'm working on a project using a Chipkit Max32. I made all the tutorials on the arduino ros serial and it works fine.

Now the problem is that i have a publisher on my computer (running Kubuntu 14.04) and i program my chipkit. After doing this:

rosrun rosserial_python serial_node.py /dev/ttyUSB1

I get the error:

[ERROR] [WallTime: 1438803266.042381] Creation of subscriber failed: agv_ipleiria ROS path [0]=/opt/ros/indigo/share/ros ROS path [1]=/opt/ros/indigo/share ROS path [2]=/opt/ros/indigo/stacks

my code is:

#include <ros.h>
#include <std_msgs/String.h>
#include <agv_ipleiria/AgvGeneral.h>


ros::NodeHandle  nh;

std_msgs::String str_msg;
ros::Publisher chatter("chatter", &str_msg);

void messageCb( const agv_ipleiria::AgvGeneral& msg){
   digitalWrite(PIN_LED2, LOW);    // set the LED off
   delay(5000);
}


ros::Subscriber<agv_ipleiria::AgvGeneral> sub("AGVipleiriaChatter", &messageCb );


char hello[13] = "hello world!";

void setup()
{
     pinMode(PIN_LED2, OUTPUT);  
  digitalWrite(PIN_LED2, LOW);    // set the LED off

  delay(5000);
  nh.initNode();
  nh.advertise(chatter);
  nh.subscribe(sub);
  digitalWrite(PIN_LED2, HIGH);   // set the LED on
  delay(700);              // wait for a second
}

void loop()
{
  str_msg.data = hello;
  chatter.publish( &str_msg );
  nh.spinOnce();
  delay(1000);
}

Where is the problem on this code?

Thank You.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by cjusto
close date 2015-11-19 07:00:58.738646

Comments

Is it valid to create a subscriber before you've called ros.initNode() on platforms running rosserial?

gvdhoorn gravatar image gvdhoorn  ( 2015-08-05 14:52:09 -0500 )edit

well, i've seen that on some projects. And it worked.

cjusto gravatar image cjusto  ( 2015-08-05 15:43:21 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-11-19 07:00:17 -0500

cjusto gravatar image

The problem was on bad defined custom package.

Problem solved.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-08-05 14:50:01 -0500

Seen: 207 times

Last updated: Nov 19 '15