[ros-users] Error with Twist message when used with rosoct

Top Page
Attachments:
Message as email
+ (text/plain)
+ publish_vel.m (text/x-objcsrc)
Delete this message
Reply to this message
Author: Eric Perko
Date:  
To: ros-users
Subject: [ros-users] Error with Twist message when used with rosoct
Hey all,

I'm trying to get some prototyping code working using the ROS
interface (latest tag) for Octave, but I've encountered a problem with
the Twist message. First, here is the specific error text when running
the attached source:

octave:1> publish_vel
ans = 1
parse error near line 32 of file
/opt/ros/stacks/common_msgs/geometry_msgs/msg/oct/geometry_msgs/geometry_msgs_Twist.m

syntax error

>>> x = [    '# This expresses velocity in free space broken into it's linear and angular parts. \n' ...


                   ^


error: error creating function handle "@geometry_msgs_Twist"
error: evaluating argument list element number 2
error: evaluating assignment expression near line 5, column 9
error: near line 5 of file `/home/eric/Downloads/publish_vel.m'

I do have my .octaverc all setup properly.

If I edit the Twist.m file and remove the apostrophe from it's, the
attached code runs just fine. It seems that the apostrophes need to be
escaped or replaced or something.

Also, the grammar in that comment in Twist.msg is wrong - it's should
be its anyways :)

- Eric
rosoct(); % apparently supposed to be included in order to connect ROS and Octave
rosoct_add_msgs('geometry_msgs')

%% test publishing a chatter topic
success = rosoct_advertise('cmd_vel',@geometry_msgs_Twist, 1);
if( ~success )
    error('failed to advertise cmd_vel');
end


for i = 1:1000000
    msg = geometry_msgs_Twist();
    msg.linear.x = 2;
    msg.angular.z = 3;
    success = rosoct_publish('cmd_vel',msg);
    if( ~success )
        error('failed to publish cmd_vel');
    end
end


success = rosoct_unadvertise('cmd_vel');
if( ~success )
    error('failed to unadvertise');
end