-
Notifications
You must be signed in to change notification settings - Fork 13
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
Conversation
@@ -1,13 +1,14 @@ | |||
// Copyright 2020-2021 Rapyuta Robotics Co., Ltd. | |||
|
|||
#pragma once | |||
|
|||
#include <random> |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
Source/RapyutaSimulationPlugins/Public/Drives/RobotVehicleMovementComponent.h
Outdated
Show resolved
Hide resolved
@praphulkallakuri I could see this PR is initiated with a couple of commits related to Lidar balancing and it looks like overlapping with #18. |
dadc596
to
71a1955
Compare
Source/RapyutaSimulationPlugins/Private/Drives/RobotVehicleMovementComponent.cpp
Outdated
Show resolved
Hide resolved
Source/RapyutaSimulationPlugins/Private/Drives/RobotVehicleMovementComponent.cpp
Outdated
Show resolved
Hide resolved
@@ -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); |
There was a problem hiding this comment.
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.
some resolved comment is not resolved yet. please double check. |
UPROPERTY(VisibleAnywhere) | ||
bool IsInitialized = false; | ||
|
||
protected: |
There was a problem hiding this comment.
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?
I got following error when play the turtlebot3-UE. Did yout test with turtlebot3 as well?
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); |
There was a problem hiding this comment.
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
void ATurtlebotBurger::InitializeMoveComponent() | ||
{ | ||
DifferentialDriveComponent = NewObject<UDifferentialDriveComponent>(this, TEXT("DifferentialDriveComponent")); |
There was a problem hiding this comment.
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.
void ATurtlebotBurger::InitializeMoveComponent() | |
{ | |
DifferentialDriveComponent = NewObject<UDifferentialDriveComponent>(this, TEXT("DifferentialDriveComponent")); | |
void ATurtlebotBurger::InitializeMoveComponent() | |
{ | |
Super::InitializeMoveComponent(); | |
DifferentialDriveComponent = NewObject<UDifferentialDriveComponent>(this, TEXT("DifferentialDriveComponent")); |
Call Super::, which initializes RobotVehicleMoveComponent [ATurtlebotBurger] definition: cleaning up
A rebase over main branch |
* Move components duplication refactored for RobotVehicle class and AMRVehicle class * Add StatePublisher class * Add InversionFactor variable in RobotVehicleMovementComponent Co-authored-by: duc <[email protected]>
Refactored code in
DifferentialDriveComponent
in TB classclass URobotVehicleMovementComponent
making it base classThanks to @Tadinu for help !!