Ask Your Question
0

Custom Message on Arduino

asked 2015-11-28 13:02:43 -0600

Noldona gravatar image

I am using ROS Indigo and an Arduino Uno. I am having issues using a custom message that is part of my firmware. The firmware compiles and uploads fine, but I receive the following error when trying to connect to the node.

$ rosrun rosserial_python serial_node.py /dev/ttyACM1
[INFO] [WallTime: 1448735717.440960] ROS Serial Python Node
[INFO] [WallTime: 1448735717.454322] Connecting to /dev/ttyACM1 at 57600 baud
[ERROR] [WallTime: 1448735720.172786] Creation of publisher failed: ros_arduino_wiichuck
ROS path [0]=/opt/ros/indigo/share/ros
ROS path [1]=/opt/ros/indigo/share
ROS path [2]=/opt/ros/indigo/stacks
[ERROR] [WallTime: 1448735721.135189] Tried to publish before configured, topic id 125
[ERROR] [WallTime: 1448735722.154916] Tried to publish before configured, topic id 125

Here is my custom message

Header header
uint8 joyX
uint8 joyY
bool buttonZ
bool buttonC
float32 accelX
float32 accelY
float32 accelZ

Here is my firmware code

#include <Arduino.h>
#include <ros.h>
#include <ros_arduino_wiichuck/WiiChuck.h>


#include "WiiChuck.h"

WiiChuck chuck = WiiChuck();

ros::NodeHandle nh;

ros_arduino_wiichuck::WiiChuck chuck_msg;
ros::Publisher chuckPub("chuck", &chuck_msg);

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

void setup() {
    nh.initNode();
    nh.advertise(chuckPub);

    chuck.begin();
    chuck.update();
}

void loop() {
    delay(20);
    chuck.update();

    chuck_msg.joyX = chuck.readJoyX();
    chuck_msg.joyY = chuck.readJoyY();
    chuck_msg.buttonZ = chuck.buttonZ;
    chuck_msg.buttonC = chuck.buttonC;
    chuck_msg.accelX = chuck.readAccelX();
    chuck_msg.accelY = chuck.readAccelY();
    chuck_msg.accelZ = chuck.readAccelZ();
    chuckPub.publish(&chuck_msg);
    nh.spinOnce();
    delay(1000);
}
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-11-28 17:29:20 -0600

ahendrix gravatar image

updated 2015-11-28 18:26:32 -0600

EDITED to be correct answer.

You ROS path only includes directories in /opt ; have you sourced the workspace that contains your custom message before starting the rosserial_python node?

edit flag offensive delete link more

Comments

I thought the advertise line was the one that registered the publisher. Also, I started with the code used in http://wiki.ros.org/rosserial_arduino... and it works perfectly fine. The issue seems to be related to the fact that it's a custom message.

Noldona gravatar imageNoldona ( 2015-11-28 17:59:05 -0600 )edit

You ROS path only includes directories in /opt ; have you sourced the workspace that contains your custom message before starting the rosserial_python node?

ahendrix gravatar imageahendrix ( 2015-11-28 18:02:28 -0600 )edit

Yeah, that was it. I didn't source the workspace.

Noldona gravatar imageNoldona ( 2015-11-28 18:22:19 -0600 )edit

Can you guys also help me with this problem? I described it in an answer below (I am new at the forum, and don't know whether I whould ask it as a new question)

Copk gravatar imageCopk ( 2015-12-12 03:49:21 -0600 )edit

You have a new, different question. Please ask a new question instead of posting an answer.

ahendrix gravatar imageahendrix ( 2015-12-12 12:49:51 -0600 )edit
0

answered 2015-12-11 16:24:07 -0600

Copk gravatar image

Hello, I have the similar problem. My error looks like that:

[ERROR] [WallTime: 1449865435.202100] Creation of publisher failed: dimrob_synctimescan
ROS path [0]=/opt/ros/indigo/share/ros
ROS path [1]=/home/copek/catkin_ws/src
ROS path [2]=/home/copek/catkin_test/src
ROS path [3]=/opt/ros/indigo/share
ROS path [4]=/opt/ros/indigo/stacks
ROS path [5]=/home/copek/indigo_workspace/sandbox

catkin_ws and catkin_test are different workspaces I am using, but the one in which is my custom message is not present on that list. My question is what do you mean by sourcing the workspace? If I type the following command

   source /home/copek/catkin_imu/devel/setup.bash

(the location of my catkin), I got the error:

[rosrun] Couldn't find executable named serial_node.py below /opt/ros/indigo/share/rosserial_python

However if I source the following:

source /opt/ros/indigo/setup.bash

I receive the error:

[ERROR] [WallTime: 1449865600.013650] Creation of publisher failed: dimrob_synctimescan
ROS path [0]=/opt/ros/indigo/share/ros
ROS path [1]=/opt/ros/indigo/share
ROS path [2]=/opt/ros/indigo/stacks

Do you have a clue wht may be wrong? Thanks for the answer :)

edit flag offensive delete link more

Comments

Okay - problem SOLVED. It was a problem with catkin - before creating the catkin workspace I didn't source the ros. To fix it I created properly a new catkin workspace and build my message there - now it works.

Copk gravatar imageCopk ( 2015-12-12 10:23:22 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-11-28 13:02:43 -0600

Seen: 1,176 times

Last updated: Dec 11 '15