Skip to content

Commit

Permalink
Python tutorial code snippet updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
sreekanthr committed Sep 11, 2024
1 parent 591c313 commit d464b1b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tutorials/06_python_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,9 @@ We can declare the throttling option using the following code :
# Setting the throttling option
opts = AdvertiseMessageOptions()
opts.msgs_per_sec = 1
pub = node.advertise(topic_name, StringMsg, opts);
if (!pub):
pub = node.advertise(topic_name, StringMsg, opts)
if not pub:
print("Error advertising topic" + topic_name)
return False
```

### Walkthrough
Expand All @@ -280,7 +279,7 @@ it to set the publishing rate (the member `msgs_per_sec`), In our case, the rate
specified is 1 msg/sec.

```{.py}
pub = node.advertise(topic_name, StringMsg, opts);
pub = node.advertise(topic_name, StringMsg, opts)
```

Next, we advertise the topic with message throttling enabled. To do it, we pass opts
Expand Down Expand Up @@ -341,8 +340,8 @@ We can declare the topic remapping option using the following code:
# Create a transport node and remap a topic.
nodeOpts = NodeOptions()
nodeOptions.add_topic_remap("/foo", "/bar");
node = Node(nodeOptions);
nodeOpts.add_topic_remap("/foo", "/bar")
node = Node(nodeOpts)
```

You can modify the publisher example to add this option.
Expand Down

0 comments on commit d464b1b

Please sign in to comment.