Skip to content

Commit

Permalink
Fix name in string message
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Hanca <[email protected]>
  • Loading branch information
jhanca-robotecai committed Sep 16, 2024
1 parent bed3ac8 commit ed58721
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace ROS2ScriptIntegration
AZ_RTTI(PublisherRequests, "{b8356874-f7ba-4436-8d98-a342d7c720d9}");
static constexpr AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
static constexpr AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
virtual void PublishStdMsgsString(const AZStd::string& topicName, const AZStd::string& value) = 0;
virtual void PublishStdMsgString(const AZStd::string& topicName, const AZStd::string& value) = 0;
virtual void PublishStdMsgEmpty(const AZStd::string& topicName) = 0;
virtual void PublishStdMsgUInt32(const AZStd::string& topicName, const uint32_t value) = 0;
virtual void PublishStdMsgInt32(const AZStd::string& topicName, const int32_t value) = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace ROS2ScriptIntegration
}

// Publishers overrides ...
void PublisherSystemComponent::PublishStdMsgsString(const AZStd::string& topicName, const AZStd::string& value)
void PublisherSystemComponent::PublishStdMsgString(const AZStd::string& topicName, const AZStd::string& value)
{
std_msgs::msg::String message;
message.data = std::string(value.c_str());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace ROS2ScriptIntegration

protected:
// ROS2ScriptIntegrationRequestBus::Handler overrides ...
void PublishStdMsgsString(const AZStd::string& topicName, const AZStd::string& value) override;
void PublishStdMsgString(const AZStd::string& topicName, const AZStd::string& value) override;

void PublishStdMsgEmpty(const AZStd::string& topicName) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ namespace ROS2ScriptIntegration
->Attribute(AZ::Script::Attributes::Category, "ROS2")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "ROS2")
->Event(
"PublishStdMsgsString", &PublisherRequestBus::Events::PublishStdMsgsString, { { { "Topic", "" }, { "Value", "" } } })
->Event("PublishStdMsgString", &PublisherRequestBus::Events::PublishStdMsgString, { { { "Topic", "" }, { "Value", "" } } })
->Event("PublishStdMsgEmpty", &PublisherRequestBus::Events::PublishStdMsgEmpty, { { { "Topic", "" } } })
->Event("PublishStdMsgUInt32", &PublisherRequestBus::Events::PublishStdMsgUInt32, { { { "Topic", "" }, { "Value", "" } } })
->Event("PublishStdMsgInt32", &PublisherRequestBus::Events::PublishStdMsgInt32, { { { "Topic", "" }, { "Value", "" } } })
Expand Down
6 changes: 3 additions & 3 deletions Gems/ROS2ScriptIntegration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Let us write a simple publisher using Script Canvas.
The "OnGraphStart" node is called on the component being activated.
It activates a "Heart Beat" node.
The "Heart Beat" node is configured to issue a pulse every 100 milliseconds.
Finally, pulse cause the publication message by node `PublishStdMsgsString`.
Finally, pulse cause the publication message by node `PublishStdMsgString`.

**Note** that the publisher is initialized on the first pulse.
To see your messages, start the simulation and type in the terminal:
Expand All @@ -37,9 +37,9 @@ You should see new messages arriving with a frequency of 10 Hertz.

The message can be published from LUA scripting language using a single call:
```lua
PublisherRequestBus.Broadcast.PublishStdMsgsString("/hello", "Hello world from Lua")
PublisherRequestBus.Broadcast.PublishStdMsgString("/hello", "Hello world from Lua")
```
in which the first parameter is a topic name and the rest of the parameters form the message (only one string in `PublishStdMsgsString` method).
in which the first parameter is a topic name and the rest of the parameters form the message (only one string in `PublishStdMsgString` method).

## Subscriber

Expand Down

0 comments on commit ed58721

Please sign in to comment.