ROS Interface message type

Typically: "How do I... ", "How can I... " questions
Post Reply
BlueSkeptical
Posts: 9
Joined: 11 Feb 2020, 15:11

ROS Interface message type

Post by BlueSkeptical »

Hi all, i'll try to explain what's my problem.
My simulation need to publish to comand_msgs/FollowJointTrajectoryActionGoal topic so i created a publisher doing:
pub = simROS.advertise('/my_topic/follow_joint_trajectory/goal', 'control_msgs/FollowJointTrajectoryActionGoal')

After i run the simulation, an error occurs:
unsupported message type. please edit and recompile ROS plugin (simROS.advertise @ 'RosInterface' plugin)

So i downloaded fferri ROS Interface plugin into my ros_workspace/src/ folder, edited messages.txt by adding this line:
control_msgs/FollowJointTrajectory
Then catkin build and everything compiled with no error. What should i do now? I tried to copy the file libsimExtROSInterface.so i found in ros_workspace/devel/lib into CoppeliaSim main directory but the simulation keeps telling me:
unsupported message type. please edit and recompile ROS plugin (simROS.advertise @ 'RosInterface' plugin)

I don't know what to do. I'm using ROS kinetic on Ubuntu 16.04

fferri
Posts: 1216
Joined: 09 Sep 2013, 19:28

Re: ROS Interface message type

Post by fferri »

if you are trying to do:

Code: Select all

pub = simROS.advertise('/my_topic/follow_joint_trajectory/goal', 'control_msgs/FollowJointTrajectoryActionGoal')
then the message you need to add in meta/messages.txt is:

Code: Select all

control_msgs/FollowJointTrajectoryActionGoal

BlueSkeptical
Posts: 9
Joined: 11 Feb 2020, 15:11

Re: ROS Interface message type

Post by BlueSkeptical »

Hi, thanks for the reply.
I tried but during catkin build this error occurs:

Code: Select all

Errors     << sim_ros_interface:make /home/j/ros_ws/logs/sim_ros_interface/build.make.017.log
/home/j/ros_ws/build/sim_ros_interface/generated/ros_msg_io.cpp: In function ‘void write__control_msgs__FollowJointTrajectoryActionGoal(const FollowJointTrajectoryActionGoal&, int, const WriteOptions*)’:
/home/j/ros_ws/build/sim_ros_interface/generated/ros_msg_io.cpp:20135:66: error: ‘write__actionlib_msgs__GoalID’ was not declared in this scope
             write__actionlib_msgs__GoalID(msg.goal_id, stack, opt);
                                                                  ^
/home/j/ros_ws/build/sim_ros_interface/generated/ros_msg_io.cpp:20148:80: error: ‘write__control_msgs__FollowJointTrajectoryGoal’ was not declared in this scope
             write__control_msgs__FollowJointTrajectoryGoal(msg.goal, stack, opt);
                                                                                ^
/home/j/ros_ws/build/sim_ros_interface/generated/ros_msg_io.cpp: In function ‘void read__control_msgs__FollowJointTrajectoryActionGoal(int, control_msgs::FollowJointTrajectoryActionGoal*, const ReadOptions*)’:
/home/j/ros_ws/build/sim_ros_interface/generated/ros_msg_io.cpp:20210:81: error: ‘read__actionlib_msgs__GoalID’ was not declared in this scope
                         read__actionlib_msgs__GoalID(stack, &(msg->goal_id), opt);
                                                                                 ^
/home/j/ros_ws/build/sim_ros_interface/generated/ros_msg_io.cpp:20224:95: error: ‘read__control_msgs__FollowJointTrajectoryGoal’ was not declared in this scope
                         read__control_msgs__FollowJointTrajectoryGoal(stack, &(msg->goal), opt);
                                                                                               ^
make[2]: *** [CMakeFiles/simExtROSInterface.dir/generated/ros_msg_io.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/simExtROSInterface.dir/all] Error 2
make: *** [all] Error 2

fferri
Posts: 1216
Joined: 09 Sep 2013, 19:28

Re: ROS Interface message type

Post by fferri »

That happens because the message you added depends on another message (actionlib_msgs/GoalID), which is not present in meta/messages.txt. Unfortunately the build system does not resolve those dependencies automatically: you have to list all the relevant messages.

BlueSkeptical
Posts: 9
Joined: 11 Feb 2020, 15:11

Re: ROS Interface message type

Post by BlueSkeptical »

Really thank you, now it works! I added:

Code: Select all

actionlib_msgs/GoalID
control_msgs/FollowJointTrajectoryGoal

Post Reply