-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #180 from phuicy/master
Adding more BP topic types
- Loading branch information
Showing
8 changed files
with
337 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
Source/ROSIntegration/Private/Conversion/Messages/std_msgs/StdMsgsEmptyConverter.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
|
||
#include "Conversion/Messages/std_msgs/StdMsgsEmptyConverter.h" | ||
|
||
|
||
UStdMsgsEmptyConverter::UStdMsgsEmptyConverter() | ||
{ | ||
_MessageType = "std_msgs/Empty"; | ||
} | ||
|
||
bool UStdMsgsEmptyConverter::ConvertIncomingMessage(const ROSBridgePublishMsg* message, TSharedPtr<FROSBaseMsg> &BaseMsg) { | ||
|
||
|
||
return true; | ||
} | ||
|
||
bool UStdMsgsEmptyConverter::ConvertOutgoingMessage(TSharedPtr<FROSBaseMsg> BaseMsg, bson_t** message) { | ||
|
||
return true; | ||
} |
21 changes: 21 additions & 0 deletions
21
Source/ROSIntegration/Private/Conversion/Messages/std_msgs/StdMsgsEmptyConverter.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
#include "Conversion/Messages/BaseMessageConverter.h" | ||
#include "std_msgs/Bool.h" | ||
#include "StdMsgsEmptyConverter.generated.h" | ||
|
||
|
||
UCLASS() | ||
class ROSINTEGRATION_API UStdMsgsEmptyConverter : public UBaseMessageConverter | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
UStdMsgsEmptyConverter(); | ||
virtual bool ConvertIncomingMessage(const ROSBridgePublishMsg* message, TSharedPtr<FROSBaseMsg> &BaseMsg); | ||
virtual bool ConvertOutgoingMessage(TSharedPtr<FROSBaseMsg> BaseMsg, bson_t** message); | ||
|
||
}; |
25 changes: 25 additions & 0 deletions
25
Source/ROSIntegration/Private/Conversion/Messages/std_msgs/StdMsgsInt64Converter.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "Conversion/Messages/std_msgs/StdMsgsInt64Converter.h" | ||
|
||
|
||
UStdMsgsInt64Converter::UStdMsgsInt64Converter() | ||
{ | ||
_MessageType = "std_msgs/Int64"; | ||
} | ||
|
||
bool UStdMsgsInt64Converter::ConvertIncomingMessage(const ROSBridgePublishMsg* message, TSharedPtr<FROSBaseMsg> &BaseMsg) { | ||
bool KeyFound = false; | ||
|
||
int64 Data = GetInt64FromBSON(TEXT("msg.data"), message->full_msg_bson_, KeyFound); | ||
if (!KeyFound) return false; | ||
|
||
BaseMsg = TSharedPtr<FROSBaseMsg>(new ROSMessages::std_msgs::Int64(Data)); | ||
return true; | ||
} | ||
|
||
bool UStdMsgsInt64Converter::ConvertOutgoingMessage(TSharedPtr<FROSBaseMsg> BaseMsg, bson_t** message) { | ||
auto Int64Message = StaticCastSharedPtr<ROSMessages::std_msgs::Int64>(BaseMsg); | ||
*message = BCON_NEW( | ||
"data", BCON_INT32(Int64Message->_Data) | ||
); | ||
return true; | ||
} |
18 changes: 18 additions & 0 deletions
18
Source/ROSIntegration/Private/Conversion/Messages/std_msgs/StdMsgsInt64Converter.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
#include "Conversion/Messages/BaseMessageConverter.h" | ||
#include "std_msgs/Int64.h" | ||
#include "StdMsgsInt64Converter.generated.h" | ||
|
||
|
||
UCLASS() | ||
class ROSINTEGRATION_API UStdMsgsInt64Converter: public UBaseMessageConverter | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
UStdMsgsInt64Converter(); | ||
virtual bool ConvertIncomingMessage(const ROSBridgePublishMsg* message, TSharedPtr<FROSBaseMsg> &BaseMsg); | ||
virtual bool ConvertOutgoingMessage(TSharedPtr<FROSBaseMsg> BaseMsg, bson_t** message); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include "ROSBaseMsg.h" | ||
|
||
namespace ROSMessages{ | ||
namespace std_msgs { | ||
class String : public FROSBaseMsg { | ||
public: | ||
String() { | ||
_MessageType = "std_msgs/Empty"; | ||
} | ||
|
||
String(FString data) { | ||
_MessageType = "std_msgs/Empty"; | ||
} | ||
|
||
//private: | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include "ROSBaseMsg.h" | ||
|
||
namespace ROSMessages{ | ||
namespace std_msgs { | ||
class Int64 : public FROSBaseMsg { | ||
public: | ||
Int64() : Int64(0.f) {} | ||
|
||
Int64(int64 data) { | ||
_MessageType = "std_msgs/Int64"; | ||
_Data = data; | ||
} | ||
|
||
//private: | ||
int64 _Data; | ||
}; | ||
} | ||
} |