ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROS will not create a message module [closed]

asked 2016-07-01 15:44:23 -0500

Raisintoe gravatar image

I am learning how to create a custom message in ROS, Kinetic. I am using python language, and have been able generated my code using catkin_make. ROS also recognizes my message when I enter: rosmsg show MyMessage.

The trouble I am having, is that no MyMessage module has been created in the msg directory. Only MyMessage.msg exists in the msg directory. What am I missing?

CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(test_py)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  message_generation
)

## Generate messages in the 'msg' folder
add_message_files(
  FILES
  MyMessage.msg
)

## Generate added messages and services with any dependencies listed here
generate_messages(
  DEPENDENCIES
  std_msgs  # Or other packages containing msgs
)

catkin_package(
  LIBRARIES test_py
  CATKIN_DEPENDS rospy
  CATKIN_DEPENDS message_runtime
)

package.xml:

<?xml version="1.0"?>
<package>
  <name>test_py</name>
  <version>0.0.0</version>
  <description>The test_py package</description>

  <maintainer email="derek@todo.todo">derek</maintainer>

  <license>TODO</license>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>rospy</build_depend>
  <run_depend>rospy</run_depend>
  <build_depend>std_msgs</build_depend>
  <run_depend>std_msgs</run_depend>
  <build_depend>message_generation</build_depend>
  <run_depend>message_runtime</run_depend>

  <export>

  </export>
</package>

My executable test_py.py:

#!/usr/bin/env python

import rospy

from std_msgs.msg import Int32
from test_py.msg import MyMessage

rospy.init_node('test_py')
pub = rospy.Publisher('counter', Int32, queue_size=10)
pubComp = rospy.Publisher('complex Data', MyMessage, queue_size = 10)

rate = rospy.Rate(2)
real = 0
msg = MyMessage();
msg.real = 0
msg.imaginary = 0
while not rospy.is_shutdown():
    pub.publish(count)
    pubComp.publish(msg)
    count += 1
    msg.real += 1
    msg.imaginary += 2
    rate.sleep()
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Raisintoe
close date 2016-07-02 13:11:21.912123

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-07-02 13:10:44 -0500

Raisintoe gravatar image

OK, the problem is that I named my executable the same as my package: test_py as my package and test_py.py as my executable. These have to be different.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-07-01 15:44:23 -0500

Seen: 170 times

Last updated: Jul 02 '16