Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Movement Components refactor #19

Merged
merged 9 commits into from
Dec 13, 2021
Merged

Movement Components refactor #19

merged 9 commits into from
Dec 13, 2021

Conversation

praphulkallakuri
Copy link
Contributor

@praphulkallakuri praphulkallakuri commented Oct 26, 2021

Refactored code in

  • Turtlebot: Added DifferentialDriveComponent in TB class
  • RobotVehicle: Added class URobotVehicleMovementComponent making it base class

Thanks to @Tadinu for help !!

@@ -1,13 +1,14 @@
// Copyright 2020-2021 Rapyuta Robotics Co., Ltd.

#pragma once

#include <random>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

@@ -20,6 +20,11 @@ class RAPYUTASIMULATIONPLUGINS_API ATurtlebotBurger : public ARobotVehicle
public:
ATurtlebotBurger(const FObjectInitializer& ObjectInitializer);

UPROPERTY(EditAnywhere, BlueprintReadWrite)
UDifferentialDriveComponent* DifferentialDriveComponent = nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we use robotMoveComponent in base class?

@Tadinu Tadinu changed the title Pk refactor Movement Components refactor Oct 26, 2021
@Tadinu Tadinu changed the title Movement Components refactor Lidar load balancing + Movement Components refactor Oct 26, 2021
@Tadinu
Copy link
Contributor

Tadinu commented Oct 27, 2021

@praphulkallakuri I could see this PR is initiated with a couple of commits related to Lidar balancing and it looks like overlapping with #18.

@praphulkallakuri praphulkallakuri changed the title Lidar load balancing + Movement Components refactor Movement Components refactor Oct 27, 2021
@@ -23,7 +23,7 @@ void URobotVehicleMovementComponent::UpdateMovement(float DeltaTime)
const FQuat OldRotation = UpdatedComponent->GetComponentQuat();

FVector position = UpdatedComponent->ComponentVelocity * DeltaTime;
FQuat DeltaRotation(FVector::ZAxisVector, AngularVelocity.Z * DeltaTime);
FQuat DeltaRotation(FVector::ZAxisVector, InversionFactor * AngularVelocity.Z * DeltaTime);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuokamoto not sure why AMRVehicle moves in a different style from TurtleBotBurger tho?
@praphulkallakuri And thus, based on the rationale, we might need a more specific name for InversionFactor I suppose.

@yuokamoto
Copy link
Contributor

some resolved comment is not resolved yet. please double check.

UPROPERTY(VisibleAnywhere)
bool IsInitialized = false;

protected:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whyd did you separated protected?

@yuokamoto
Copy link
Contributor

yuokamoto commented Nov 5, 2021

I got following error when play the turtlebot3-UE. Did yout test with turtlebot3 as well?

Caught signal 11 Segmentation fault

libUE4Editor-RapyutaSimulationPlugins.so!ATurtlebotBurger::BeginPlay() [/home/yu/turtlebot3-UE/Plugins/RapyutaSimulationPlugins/Source/RapyutaSimulationPlugins/Private/Robots/Turtlebot3/TurtlebotBurger.cpp:145]
libUE4Editor-Engine.so!AActor::DispatchBeginPlay(bool) [/home/yu/UnrealEngine/Engine/Source/Runtime/Engine/Private/Actor.cpp:3517]
libUE4Editor-Engine.so!AWorldSettings::NotifyBeginPlay() [/home/yu/UnrealEngine/Engine/Source/Runtime/Engine/Private/WorldSettings.cpp:247]
libUE4Editor-Engine.so!AGameStateBase::HandleBeginPlay() [/home/yu/UnrealEngine/Engine/Source/Runtime/Engine/Private/GameStateBase.cpp:204]
libUE4Editor-Engine.so!UWorld::BeginPlay() [/home/yu/UnrealEngine/Engine/Source/Runtime/Engine/Private/World.cpp:4415]
libUE4Editor-Engine.so!UGameInstance::StartPlayInEditorGameInstance(ULocalPlayer*, FGameInstancePIEParameters const&) [/home/yu/UnrealEngine/Engine/Source/Runtime/Engine/Private/GameInstance.cpp:483]
libUE4Editor-UnrealEd.so!UEditorEngine::CreateInnerProcessPIEGameInstance(FRequestPlaySessionParams&, FGameInstancePIEParameters const&, int) [/home/yu/UnrealEngine/Engine/Source/Editor/UnrealEd/Private/PlayLevel.cpp:2943]
libUE4Editor-UnrealEd.so!UEditorEngine::OnLoginPIEComplete_Deferred(int, bool, FString, FPieLoginStruct) [/home/yu/UnrealEngine/Engine/Source/Editor/UnrealEd/Private/PlayLevel.cpp:1502]
libUE4Editor-UnrealEd.so!UEditorEngine::CreateNewPlayInEditorInstance(FRequestPlaySessionParams&, bool, EPlayNetMode) [/home/yu/UnrealEngine/Engine/Source/Editor/UnrealEd/Private/PlayLevel.cpp:1746]
libUE4Editor-UnrealEd.so!UEditorEngine::StartPlayInEditorSession(FRequestPlaySessionParams&) [/home/yu/UnrealEngine/Engine/Source/Editor/UnrealEd/Private/PlayLevel.cpp:2709]
libUE4Editor-UnrealEd.so!UEditorEngine::StartQueuedPlaySessionRequestImpl() [/home/yu/UnrealEngine/Engine/Source/Editor/UnrealEd/Private/PlayLevel.cpp:1103]
libUE4Editor-UnrealEd.so!UEditorEngine::StartQueuedPlaySessionRequest() [/home/yu/UnrealEngine/Engine/Source/Editor/UnrealEd/Private/PlayLevel.cpp:1015]
libUE4Editor-UnrealEd.so!UEditorEngine::Tick(float, bool) [/home/yu/UnrealEngine/Engine/Source/Editor/UnrealEd/Private/EditorEngine.cpp:1628]
libUE4Editor-UnrealEd.so!UUnrealEdEngine::Tick(float, bool) [/home/yu/UnrealEngine/Engine/Source/Editor/UnrealEd/Private/UnrealEdEngine.cpp:423]
UE4Editor!FEngineLoop::Tick() [/home/yu/UnrealEngine/Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp:4916]
UE4Editor!GuardedMain(char16_t const*) [/home/yu/UnrealEngine/Engine/Source/Runtime/Launch/Private/Launch.cpp:180]
libUE4Editor-UnixCommonStartup.so!CommonUnixMain(int, char**, int (*)(char16_t const*), void (*)()) [/home/yu/UnrealEngine/Engine/Source/Runtime/Unix/UnixCommonStartup/Private/UnixCommonStartup.cpp:264]
libc.so.6!__libc_start_main(+0xf2)

UE4Editor!_start()

@@ -46,12 +46,12 @@ void URobotVehicleMovementComponent::InitOdom()
InitialTransform.SetTranslation(PawnOwner->GetActorLocation());
InitialTransform.SetRotation(FQuat(PawnOwner->GetActorRotation()));

PreviousTransform = FTransform(FQuat(0,0,0,1), FVector(0,0,0), FVector(1,1,1));
PreviousTransform = FTransform(FQuat::Identity, FVector::ZeroVector, FVector::OneVector);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I looked too quickly, this could be actually FTransform::Identity

Comment on lines 19 to 22
void ATurtlebotBurger::InitializeMoveComponent()
{
DifferentialDriveComponent = NewObject<UDifferentialDriveComponent>(this, TEXT("DifferentialDriveComponent"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@praphul Kallakuri For the crash that Yu might have just noted, though ATurtlebotBurger seems to be not using RobotVehicleMoveComponent, you could call Super::InitializeMoveComponent() here to initialize it, since in our parent class ARobotVehicle it is currently hooked up to be initialized.

Suggested change
void ATurtlebotBurger::InitializeMoveComponent()
{
DifferentialDriveComponent = NewObject<UDifferentialDriveComponent>(this, TEXT("DifferentialDriveComponent"));
void ATurtlebotBurger::InitializeMoveComponent()
{
Super::InitializeMoveComponent();
DifferentialDriveComponent = NewObject<UDifferentialDriveComponent>(this, TEXT("DifferentialDriveComponent"));

@Tadinu
Copy link
Contributor

Tadinu commented Dec 13, 2021

A rebase over main branch

@Tadinu Tadinu merged commit 0dfef1d into main Dec 13, 2021
@Tadinu Tadinu deleted the pk_refactor branch December 13, 2021 08:35
Tadinu pushed a commit that referenced this pull request Jan 5, 2022
* Move components duplication refactored for RobotVehicle class and AMRVehicle class
* Add StatePublisher class
* Add InversionFactor variable in RobotVehicleMovementComponent
Co-authored-by: duc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants