[ros-users] AVR and ROS

Homer Manalo homer.manalo at roboteknik.com
Wed Feb 9 11:09:30 UTC 2011


I found the culprit with the error: ‘string’ in namespace ‘ROS’ does not
name a type.
The ros_string.h has the ff. lines:
  #ifndef STRING_H_
  #define STRING_H_
Should be:
  #ifndef ROS_STRING_H_
  #define ROS_STRING_H_
The filename on the top of the comment is string.h as well. It also solved
the error: ‘class std_msgs::String’ has no member named ‘data’. It seems
that this is also the reason for the previous error I got regarding
std_msgs::String. I don't have to reorder the #include files anymore.

I,ve got a couple more errors this time:
  char Ros::getTopicTag(char *topic) {
    ../avrRos/ros_generated.cpp:6: error: prototype for ‘char
Ros::getTopicTag(char*)’ does not match any in class ‘Ros’

  char getTopicTag(char const *topic);
  ../avrRos/Ros.h:132: error: candidate is: char Ros::getTopicTag(const
char*)

I replaced the autogenerated ros_generated.cpp with this:

  /* This file was autogenerated as a part of the avr_bridge pkg
   * avr_bridge was written by Adam Stambler and Phillip Quiza of
   * Rutgers University.
   */
  #include "Ros.h"
  #include "string.h"  //added manually for strcmp
  char Ros::getTopicTag(char const *topic) {  //manually added const to
resolve above errors
      if (!strcmp(topic, "call"))
          return 0;
      if (!strcmp(topic, "response"))
          return 1;
      return 0;  //manually added semicolon(;)
  }
  Ros ros("callResponse", 2);

I'm not sure if this is the right solution but the errors are gone now,
except one. It's a make error, here is the console output:

**** Build of configuration Release for project avr_bridgeHelloWorld ****

make all
Building target: avr_bridgeHelloWorld.elf
Invoking: AVR C++ Linker
avr-gcc --cref -s -Os -o"avr_bridgeHelloWorld.elf"  ./avrRos_user.o
./main.o  ./avrRos/Ros.o ./avrRos/String.o ./avrRos/cc_support.o
./avrRos/ros_generated.o ./avrRos/ros_string.o   -lArduinoProMini5VCore -lm
-Wl,-Map,avr_bridgeHelloWorld.map,--cref
-L/home/roboteknik/eclipse/ArduinoCores -mmcu=atmega328p
./main.o: In function `__static_initialization_and_destruction_0(int, int)':
main.cpp:(.text._Z41__static_initialization_and_destruction_0ii+0x2c):
undefined reference to `std_msgs::String::~String()'
main.cpp:(.text._Z41__static_initialization_and_destruction_0ii+0x34):
undefined reference to `std_msgs::String::~String()'
make: *** [avr_bridgeHelloWorld.elf] Error 1

I'm not sure how to solve this error.


On Wed, Feb 9, 2011 at 2:51 PM, Homer Manalo <homer.manalo at roboteknik.com>wrote:

> Ok now I have sorted out about the std_msgs error by ordering the #include
> lines and object declarations:
>
>   #include <WProgram.h>
>   #include <stdio.h>
>
>   #include "avrRos/String.h"
>
>   std_msgs::String call_msg;
>   std_msgs::String response_msg;
>
>   #include "avrRos/Ros.h"
>
> But I still got some errors here:
>
>   sprintf(response_msg.data.getRawString(), "You sent : %s",
> call_msg.data.getRawString());
>     ../main.cpp:35: error: ‘class std_msgs::String’ has no member named
> ‘data’
>     ../main.cpp:35: error: ‘class std_msgs::String’ has no member named
> ‘data’
>
>   call_msg.data.setMaxLength(30);
>   response_msg.data.setMaxLength(60);
>     ../main.cpp:50: error: ‘class std_msgs::String’ has no member named
> ‘data’
>     ../main.cpp:51: error: ‘class std_msgs::String’ has no member named
> ‘data’
>
>   ROS::string data;
>     ../avrRos/String.h:18: error: ‘string’ in namespace ‘ROS’ does not name
> a type
>
>   ROS::string name;
>     ../avrRos/Ros.h:117: error: ‘string’ in namespace ‘ROS’ does not name a
> type
>
>
>
>
> On Tue, Feb 8, 2011 at 4:41 PM, Homer Manalo <homer.manalo at roboteknik.com>wrote:
>
>> Hello, I'm following the hello world tutorial and getting build errors
>> particularly with these two lines:
>>
>>   std_msgs::String call_msg;
>>   std_msgs::String response_msg;
>>
>>   ../main.cpp:21: error: ‘std_msgs’ has not been declared
>>   ../main.cpp:21: error: expected constructor, destructor, or type
>> conversion before ‘call_msg’
>>   ../main.cpp:22: error: ‘std_msgs’ has not been declared
>>   ../main.cpp:22: error: expected constructor, destructor, or type
>> conversion before ‘response_msg’
>>
>> Other errors are just because of the two variables not being declared.
>>
>>
>>
>> On Mon, Jan 10, 2011 at 4:10 AM, Adam Stambler <adasta at gmail.com> wrote:
>>
>>> Hi
>>>
>>> Configuring eclipse can be a bit tricky.  This tutorial was the most
>>> straight forward explanation:
>>>
>>> http://www.arduino.cc/playground/Code/Eclipse
>>>
>>> If you are still having trouble, let me know and I will write up an
>>> explanation on the ROS site.
>>>
>>> -Adam
>>>
>>>
>>> On Sun, Jan 9, 2011 at 2:36 PM, airthimble <
>>> joseph.st.amand at mines.sdsmt.edu> wrote:
>>>
>>>>
>>>> I have been trying to use this package in order to communicate with a
>>>> Seeduino. I tried following the avr-bridge tutorial but had trouble with
>>>> it.
>>>> I typically put together a make file for a project and just use a text
>>>> editor. I have no trouble using eclipse, I just cannot figure out how to
>>>> configure it. There does not seem to be a well-made tutorial for
>>>> configuring
>>>> eclipse in Ubuntu 11.04.
>>>>
>>>> If anyone would be able to give me a push in the right direction it
>>>> would be
>>>> much appreciated!
>>>>
>>>> Thanks!
>>>> --
>>>> View this message in context:
>>>> http://ros-users.122217.n3.nabble.com/AVR-and-ROS-tp2200563p2222791.html
>>>> Sent from the ROS-Users mailing list archive at Nabble.com.
>>>> _______________________________________________
>>>> ros-users mailing list
>>>> ros-users at code.ros.org
>>>> https://code.ros.org/mailman/listinfo/ros-users
>>>>
>>>
>>>
>>> _______________________________________________
>>> ros-users mailing list
>>> ros-users at code.ros.org
>>> https://code.ros.org/mailman/listinfo/ros-users
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20110209/51c8d252/attachment-0003.html>


More information about the ros-users mailing list