Custom Message Issue on excercise 3.3

I have created the custom message, wish shows properly when doing: rosmsg list | grep Age. (odomsubscriber/Age)

The message shows properly when issued rosmsg show Age. ([odomsubscriber/Age]:
float32 years
float32 month
float32 days

My launch file seems to be working just fine:

My .py looks just fine:

#! /usr/bin/env python

import rospy

from odomsubscriber.msg import Age

rospy.init_node(‘agenode’)

pub = rospy.Publisher(’/zage’, Age, queue_size=1)

rate = rospy.Rate(2)

age = age()

age.years = 8

age.months = 8

age.days = 8

while not rospy.is_shutdown():

pub.publish(age)

rate.sleep()

No issues are reported when issued catkin_make.
No issues reported when issuing roslaunch odomsubscriber agepublisher.launch . I get:

SUMMARY

PARAMETERS

  • /rosdistro: kinetic
  • /rosversion: 1.12.14

NODES
/
agenode (odomsubscriber/agepublisher.py)

ROS_MASTER_URI=http://master:11311

process[agenode-1]: started with pid [27192]

I have issued source devel/setup.bash.

I dont get any error codes.
But the agenode doesnt show up anywhere, nor does the zage topic.

I have tried going to other courses and go back to re start the simulation.
I tried deleting devel and build and issue catkin_make again.

I’ve been hung here for 2 days… and this just bugs me too much I can’t continue if I can’t resolve this.

help!

solved it.

after running rosrun on my .py, i noticed that my variable definition was incorrect, needed to write Age(), I wrote “age()”.

also my message had a missing “s” in month-s. so in my .py it was trying to assign the value to a “variable” that didnt exist. that was causing the script to no excecute properly.

2 Likes