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

[solved] rosrun beginner_tutorials talker.py has no effect

asked 2018-08-12 07:11:22 -0500

loic gravatar image

updated 2018-08-15 13:53:35 -0500

I apply the WritingPublisherSubscriber(python) tutorial page.

I copy/paste the code of talker.py (error on wget)

I execute

$ catkin_make

roscore is runing

Then I execute

$ rosrun --debug beginner_tutorials talker.py
[rosrun] Looking in catkin libexec dirs: /home/pi/catkin_ws/devel/share/beginner_tutorials
[rosrun] Looking in rospack dir: /home/pi/catkin_ws/src/beginner_tutorials
[rosrun] Searching for talker.py with permissions /111
[rosrun] Running /home/pi/catkin_ws/src/beginner_tutorials/scripts/talker.py

Not more output. After 1 sec or less, I return to the prompt. Nothing in rqt_console.

Could anyone help me?

edit retag flag offensive close merge delete

Comments

Two questions:

1 - after catkin_make did you source the setup file("source devel/setup.bash")?

2 - Did you restart roscore after catkin_make?

billy gravatar image billy  ( 2018-08-12 13:37:53 -0500 )edit

Thanks for questions. 1. Not before your question. Yes now. Without more result. 2. Yes.

loic gravatar image loic  ( 2018-08-12 13:56:54 -0500 )edit

Did you try "rostopic list" to see if the talker is talking?

billy gravatar image billy  ( 2018-08-12 15:06:38 -0500 )edit

Thanks. If I start listener.py, I have:

$ rostopic list
/chatter
/rosout
/rosout_agg

Good. Next step :

$ rostopic type /chatter 
std_msgs/String
$ rostopic hz /chatter 
subscribed to [/chatter]
no new messages
no new messages
..
loic gravatar image loic  ( 2018-08-13 15:02:46 -0500 )edit

If I run only talker.py and not listener.py, I have:

$ rostopic list -v

Published topics:
 * /rosout_agg [rosgraph_msgs/Log] 1 publisher

Subscribed topics:
 * /rosout [rosgraph_msgs/Log] 1 subscriber
loic gravatar image loic  ( 2018-08-13 15:19:18 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-08-15 13:51:17 -0500

loic gravatar image

I have found the issue.

It was a problem of indentation in the script talker.py (the conditional part of script was put in the def part.)

Thanks to the helpers.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-08-12 06:20:42 -0500

Seen: 728 times

Last updated: Aug 15 '18