Re: [ros-users] rosserial API Review

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: Re: [ros-users] rosserial API Review
Hi

Can we use array in rosserial?
I'm trying following code, but it doesn't work.
The topic has no data.

We are using rosserial of revision 133:db62c6309a50 tip.
Does anyone have suggestion?


#include <ros.h>
#include <std_msgs/Int16.h>
#include <std_msgs/Int16MultiArray.h>

#include <WProgram.h>
#include <Servo.h>

ros::NodeHandle nh;

std_msgs::Int16MultiArray thermo;
ros::Publisher thermo_pub("thermo", &thermo);

unsigned char dim0_label[] = "thermo";
void setup()
{
nh.initNode();
thermo.layout.dim = (std_msgs::MultiArrayDimension
*)malloc(sizeof(std_msgs::MultiArrayDimension) * 2);
thermo.layout.dim[0].label = dim0_label;
thermo.layout.dim[0].size = 8;
thermo.layout.dim[0].stride = 1*8;
thermo.data = (int *)malloc(sizeof(int)*8);
nh.advertise(thermo_pub);
}

void loop()
{
thermo.data[0] = analogRead(0);
thermo.data[1] = analogRead(1);
thermo.data[2] = analogRead(2);
thermo.data[3] = analogRead(3);
thermo.data[4] = analogRead(4);
thermo.data[5] = analogRead(5);
thermo.data[6] = analogRead(6);
thermo.data[7] = analogRead(7);

thermo_pub.publish( &thermo );

nh.spinOnce();

delay(500);
}

tsuda@tsuda-laptop:~$ rostopic echo /thermo
layout:
dim: []
data_offset: 0
data: []
---




2011/8/6 Michael Ferguson <>:
> We do not currently have an equivalent. However, development of one has been
> added to the todo list from the review.
>
> -Fergs
>
> On Thu, Aug 4, 2011 at 8:28 PM, Atsushi Tsuda <>
> wrote:
>>
>> Hi all.
>>
>> I want to use ROS_INFO on rosserial.
>> Does anyone support this?
>>
>> Cheers,
>> A.Tsuda
>>
>> 2011/8/5 Adam Stambler <>:
>> > Hi Mike,
>> >
>> > Its not too late. Thats a good suggestion. It has been ticketed and I
>> > will
>> > add it sometime early next week.
>> >
>> > Cheers,
>> > Adam
>> >
>> > On Thu, Aug 4, 2011 at 1:40 PM, Mike Purvis
>> > <>
>> > wrote:
>> >>
>> >> Ah, I missed the deadline for this.
>> >> What are the plans for supporting parameters? If I have control loop
>> >> constants or whatever else, it would be great to be able to send them
>> >> down
>> >> from a launch file rather than having to reprogram the micro every
>> >> time.
>> >> Thanks,
>> >> Mike
>> >>
>> >> On 1 August 2011 17:28, Michael Ferguson <> wrote:
>> >>>
>> >>> Greetings,
>> >>>
>> >>> An API review page has been posted for rosserial:
>> >>>
>> >>> http://www.ros.org/wiki/rosserial/Reviews/2011-08-04%20API%20Review_API_Review
>> >>>
>> >>> If you have feedback on the API, please post comments by this
>> >>> Thursday.
>> >>> You may also want to "subscribe" to the wiki page to receive email
>> >>> updates.
>> >>>
>> >>> -Mike Ferguson
>> >>>
>> >>> _______________________________________________
>> >>> ros-users mailing list
>> >>>
>> >>> https://code.ros.org/mailman/listinfo/ros-users
>> >>>
>> >>
>> >>
>> >> _______________________________________________
>> >> ros-users mailing list
>> >>
>> >> https://code.ros.org/mailman/listinfo/ros-users
>> >>
>> >
>> >
>> > _______________________________________________
>> > ros-users mailing list
>> >
>> > https://code.ros.org/mailman/listinfo/ros-users
>> >
>> >
>> _______________________________________________
>> ros-users mailing list
>>
>> https://code.ros.org/mailman/listinfo/ros-users
>
>
> _______________________________________________
> ros-users mailing list
>
> https://code.ros.org/mailman/listinfo/ros-users
>
>




--
津田 敦史
東京大学工学部機械情報工学科
稲葉・岡田研究室(情報システム工学研究室)
〒113-8656 東京都文京区本郷7-3-1 工学部2号館73B2
Tel: 03-5841-7416 / Fax: 03-5841-6285
E-mail: