I am in part 2 of the service unit. Currently struggling with Exercise 3.2.

Here is a segment of the code


def __init__(self):
    self.node_terminated = False
    self.bb8_vel_publisher = rospy.Publisher('/cmd_vel', Twist, queue_size=1)
    self.rate = rospy.Rate(10) # 10hz

def move_forward(self,speed):
    #while not self.node_terminated:
    connections = self.bb8_vel_publisher.get_num_connections()
    #if connections > 0:
    movement_msg = Twist()
    movement_msg.linear.x = speed


The number of connections printed turns out to be zero. Which should not be the case since the robot should be subscribed to that topic, so I should have at least one connection.

Additionally, when I manually publish values to the topic, the robot does not move even though I can clearly see the echoed values in the terminal.

I restarted my browser couple of times as a way to reset everything to initial condition, but that didn't work.

asked 05 Oct '17, 02:21

youssefkhaky%40hotmail.com's gravatar image

accept rate: 0%

Well, it might have been some strange error in the simulation, or maybe something was not right. I have tried to simply publish a Twist message and it moved. Copy paste this command, it should start moving.

rostopic pub /cmd_vel geometry_msgs/Twist '{linear: {x: 0.1, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'

permanent link

answered 14 Oct '17, 19:23

duckfrost%40gmail.com's gravatar image

duckfrost@gm... ♦♦
accept rate: 36%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 05 Oct '17, 02:21

question was seen: 445 times

last updated: 14 Oct '17, 19:23

powered by OSQA