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

Added parameter to toggle manual control of entities with VehicleModelComponent in Editor #397

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Gems/ROS2/Code/Source/VehicleDynamics/VehicleModelComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ namespace ROS2::VehicleDynamics
void VehicleModelComponent::Activate()
{
VehicleInputControlRequestBus::Handler::BusConnect(GetEntityId());
m_manualControlEventHandler.Activate(GetEntityId());

if (m_manuallyControled)
m_manualControlEventHandler.Activate(GetEntityId());
lewandowskikacper marked this conversation as resolved.
Show resolved Hide resolved
AZ::TickBus::Handler::BusConnect();
}

Expand All @@ -41,8 +43,10 @@ namespace ROS2::VehicleDynamics

if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
{
serialize->Class<VehicleModelComponent, AZ::Component>()->Version(4)->Field(
"VehicleConfiguration", &VehicleModelComponent::m_vehicleConfiguration);
serialize->Class<VehicleModelComponent, AZ::Component>()
->Version(4)
->Field("VehicleConfiguration", &VehicleModelComponent::m_vehicleConfiguration)
->Field("ManualControl", &VehicleModelComponent::m_manuallyControled);

if (AZ::EditContext* ec = serialize->GetEditContext())
{
Expand All @@ -51,7 +55,12 @@ namespace ROS2::VehicleDynamics
AZ::Edit::UIHandlers::Default,
&VehicleModelComponent::m_vehicleConfiguration,
"Vehicle settings",
"Vehicle settings including axles and common wheel parameters");
"Vehicle settings including axles and common wheel parameters")
->DataElement(
AZ::Edit::UIHandlers::Default,
&VehicleModelComponent::m_manuallyControled,
"ManualControl",
lewandowskikacper marked this conversation as resolved.
Show resolved Hide resolved
"Enable manual control of the vehicle");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ namespace ROS2::VehicleDynamics

protected:
ManualControlEventHandler m_manualControlEventHandler;
bool m_manuallyControled = true;
lewandowskikacper marked this conversation as resolved.
Show resolved Hide resolved
VehicleInputDeadline m_inputsState;
VehicleDynamics::VehicleConfiguration m_vehicleConfiguration;
virtual DriveModel* GetDriveModel() = 0;
Expand Down