Skip to content

Commit 96fda3b

Browse files
github-actions[bot]yuokamototetorea
authored
Spline path (#335) (#337)
* add spline following mode to AIController * update document --------- Co-authored-by: yuokamoto <[email protected]> Co-authored-by: torea Foissotte <[email protected]>
1 parent 84fcdef commit 96fda3b

File tree

15 files changed

+304
-59
lines changed

15 files changed

+304
-59
lines changed
631 KB
Binary file not shown.
35 KB
Binary file not shown.
2.92 KB
Binary file not shown.
11.8 KB
Binary file not shown.
39.7 KB
Binary file not shown.

Content/AI/BT_ROS2Agent.uasset

4.32 KB
Binary file not shown.
-26.2 KB
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:50ececfab355ad73ee1ea07f899c6867942e23b03e665430c8b7b3f55577c221
3-
size 78795
2+
oid sha256:ede98bed97b6b96e6150d1e72c7efa1cbea2d8017939d3a5ef91c048fbf152e9
3+
size 81034

Content/Tools/BP_SplinePath.uasset

73 KB
Binary file not shown.

Source/RapyutaSimulationPlugins/Private/Robots/RRAIRobotROSController.cpp

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,49 @@
1414
#include "Robots/RRBaseRobot.h"
1515
#include "Robots/RRRobotROS2Interface.h"
1616

17+
void URRAIRobotROSControllerParam::SetParametersFromPawn(ARRAIRobotROSController* InController) const
18+
{
19+
if (!InController)
20+
{
21+
UE_LOG_WITH_INFO_NAMED(LogRapyutaCore, Error, TEXT("FCoontroller is null"));
22+
return;
23+
}
24+
InController->bDebug = bDebug;
25+
InController->OrientationTolerance = OrientationTolerance;
26+
InController->LinearMotionTolerance = LinearMotionTolerance;
27+
InController->bTeleportOnFail = bTeleportOnFail;
28+
InController->Mode = Mode;
29+
InController->RandomMoveBoundingBox = RandomMoveBoundingBox;
30+
InController->GoalSequence = GoalSequence;
31+
InController->GoalSequenceActor = GoalSequenceActor;
32+
InController->OriginActor = OriginActor;
33+
InController->Origin = Origin;
34+
35+
// ROS related parameters
36+
InController->NavStatusPublicationFrequencyHz = NavStatusPublicationFrequencyHz;
37+
InController->SetSpeedTopicName = SetSpeedTopicName;
38+
InController->SetAngularVelTopicName = SetAngularVelTopicName;
39+
InController->SetModeTopicName = SetModeTopicName;
40+
InController->NavStatusTopicName = NavStatusTopicName;
41+
InController->PoseGoalTopicName = PoseGoalTopicName;
42+
InController->ActorGoalTopicName = ActorGoalTopicName;
43+
44+
BPSetParametersFromPawn(InController);
45+
}
46+
1747
void ARRAIRobotROSController::OnPossess(APawn* InPawn)
1848
{
1949
Super::OnPossess(InPawn);
2050

51+
// Get param from Pawn
52+
URRAIRobotROSControllerParam* param = InPawn->FindComponentByClass<URRAIRobotROSControllerParam>();
53+
if (param)
54+
{
55+
param->SetParametersFromPawn(this);
56+
}
57+
58+
InitParameters();
59+
2160
/**
2261
* @todo this won't work with client-server
2362
*/
@@ -29,6 +68,26 @@ void ARRAIRobotROSController::OnUnPossess()
2968
Super::OnUnPossess();
3069
}
3170

71+
void ARRAIRobotROSController::InitParameters()
72+
{
73+
if (OriginActor)
74+
{
75+
Origin = OriginActor->GetTransform();
76+
}
77+
78+
// Transform to world transform
79+
for (int i = 0; i < GoalSequence.Num(); i++)
80+
{
81+
GoalSequence[i] = URRGeneralUtils::GetWorldTransform(Origin, GoalSequence[i], true);
82+
}
83+
84+
// Transform GoalSequenceActor to GoalSequence
85+
for (AActor* actor : GoalSequenceActor)
86+
{
87+
GoalSequence.Add(actor->GetTransform());
88+
}
89+
}
90+
3291
void ARRAIRobotROSController::InitROS2Interface()
3392
{
3493
InitPropertiesFromJSON();
@@ -1096,7 +1155,8 @@ FTransform ARRAIRobotROSController::GetOrigin()
10961155
{
10971156
if (OriginActor)
10981157
{
1099-
return OriginActor->GetTransform();
1158+
Origin = OriginActor->GetTransform();
1159+
return Origin;
11001160
}
11011161
else
11021162
{

0 commit comments

Comments
 (0)