You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having some trouble getting the topic I'm publishing on from inside Unreal to reach outside Unreal to a terminal on my main system.
Some info:
Ubuntu 22.04
Unreal 5.1 built from source
ROS2 humble
If I make a subscriber in Unreal it seems to receive what is published from the publisher in Unreal though.
The terminal just looks like this:
ros2 topic list
/parameter_events
/rosout
Any ideas as to what the problem could be?
Here is the code for the publisher (but I don't think the code is actually the issue):
TestPublisher.h
#pragma once
#include"CoreMinimal.h"
#include"GameFramework/Actor.h"
#include"Msgs/ROS2Str.h"
#include<ROS2Publisher.h>
#include"TestPublisher.generated.h"UCLASS()
class FIRSTUNREALPROJECT_API ATestPublisher : public AActor
{
GENERATED_BODY()
public:// Sets default values for this actor's propertiesATestPublisher();
protected:// Called when the game starts or when spawnedvirtualvoidBeginPlay() override;
public:// Called every framevirtualvoidTick(float DeltaTime) override;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UROS2NodeComponent* Node = nullptr;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UROS2Publisher* Publisher = nullptr;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString TopicName = TEXT("test_topic");
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString Message = TEXT("Hello from C++");
private:voidPublishMessage();
FTimerHandle TimerHandle;
};
TestPublisher.cpp
#include"TestPublisher.h"// Sets default valuesATestPublisher::ATestPublisher()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
Node = CreateDefaultSubobject<UROS2NodeComponent>(TEXT("ROS2NodeComponent"));
Node->Name = TEXT("subscriber_node");
}
// Called when the game starts or when spawnedvoidATestPublisher::BeginPlay()
{
Super::BeginPlay();
Node->Init();
Publisher = Node->CreatePublisher(TopicName, UROS2Publisher::StaticClass(), UROS2StrMsg::StaticClass(), UROS2QoS::KeepLast);
FROSStr msg;
msg.Data = FString::Printf(TEXT("%s from non loop publisher"), *Message);
CastChecked<UROS2StrMsg>(Publisher->TopicMessage)->SetMsg(msg);
GetWorld()->GetTimerManager().SetTimer(TimerHandle, this, &ATestPublisher::PublishMessage, 1.0, true);
}
// Called every framevoidATestPublisher::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
voidATestPublisher::PublishMessage()
{
UE_LOG(LogTemp, Warning, TEXT("Publishing message"));
Publisher->Publish();
}
The text was updated successfully, but these errors were encountered:
Hi, I just started using Ubuntu 22.04 with the turtlebot3 repo and I had the same problem. Ignoring the dds-wrapping scripts and just running the world with $UE5_DIR/Engine/Binaries/Linux/UnrealEditor turtlebot.uproject, then just sourcing ROS in the receiving terminal, made me able to see and echo all topics published by the simulation.
Hi!
I'm having some trouble getting the topic I'm publishing on from inside Unreal to reach outside Unreal to a terminal on my main system.
Some info:
Ubuntu 22.04
Unreal 5.1 built from source
ROS2 humble
If I make a subscriber in Unreal it seems to receive what is published from the publisher in Unreal though.
The terminal just looks like this:
Any ideas as to what the problem could be?
Here is the code for the publisher (but I don't think the code is actually the issue):
TestPublisher.h
TestPublisher.cpp
The text was updated successfully, but these errors were encountered: