Update sdv_packager (#6)

This commit is contained in:
tompzf
2026-03-27 14:12:49 +01:00
committed by GitHub
parent 234be8917f
commit aefefd52f7
717 changed files with 42252 additions and 11334 deletions

View File

@@ -1,3 +1,13 @@
#*******************************************************************************
# Copyright (c) 2025-2026 ZF Friedrichshafen AG
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
#*******************************************************************************
project(SystemDemoExample)
# Use new policy for project version settings and default warning level
@@ -205,16 +215,11 @@ add_custom_target(example_user_config
VERBATIM
)
######################################################################################################################################################################
# TODO: SDV_PACKAGER does not create the toml files, therefore we need to copy them
######################################################################################################################################################################
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/demo.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3001)
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/platform.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3001)
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/settings.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3001)
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/vehicle_abstract.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3001)
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/vehicle_ifc.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3001)
add_custom_target(example_platform_config
ALL
COMMAND "${SDV_PACKAGER}" CONFIGURE ${PROJECT_SOURCE_DIR}/coreconfig/platform.toml --instance3001 --platform_config
VERBATIM
)
######################################################################################################################################################################
# system demo fmu for OpenXilEnv
@@ -224,7 +229,7 @@ file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/vehicle_ifc.toml DESTINATION ${SDV_F
#
# What cannot be created automatically is the method OpenAPILoad(const std::string& resources) in file model.cpp
# The method must load all required components
# Therfore here the file is copied and overwritten the auto generated file
# Therefore here the file is copied and overwritten the auto generated file
#
# The required toml files need to be copied to the folder:
# generated/fmu_DemoExampleFMU/DemoExampleFMU/resources

View File

@@ -4,5 +4,6 @@ Version = 100
[[Component]]
Path = "can_com_sim.sdv"
Class = "CAN_Com_Sim"
[Component.Parameters]
Source="system_demo_receiver.asc"
Target="system_demo_writer.asc"

View File

@@ -4,6 +4,7 @@ Version = 100
[[Component]]
Path = "can_com_sim.sdv"
Class = "CAN_Com_Sim"
[Component.Parameters]
Source="system_demo_receiver.asc"
Target="system_demo_writer.asc"

View File

@@ -1,3 +1,13 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#include "console.h"
#ifdef _WIN32

View File

@@ -1,3 +1,13 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#ifndef CONSOLE_OUTPUT_H
#define CONSOLE_OUTPUT_H

View File

@@ -1,3 +1,13 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#include "control.h"
CExampleControl::~CExampleControl()

View File

@@ -1,3 +1,13 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#ifndef EXMAPLE_UTILITY_H
#define EXMAPLE_UTILITY_H

View File

@@ -1,3 +1,13 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
/**
* namespace for the signal names
* in case /generated/vss_files/signal_identifier.h

View File

@@ -1,3 +1,13 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#ifdef __unix__
#include <semaphore.h>
#include <time.h>

View File

@@ -1,3 +1,13 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#include <iostream>
#include <string>
#include <filesystem>

View File

@@ -1,3 +1,13 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#include <iostream>
#include "complex_service.h"
@@ -8,22 +18,17 @@ CCounterSteeringExampleService::CCounterSteeringExampleService()
}
CCounterSteeringExampleService::~CCounterSteeringExampleService()
{
// Just in case...
Shutdown();
}
{}
void CCounterSteeringExampleService::Initialize(const sdv::u8string& /*ssObjectConfig*/)
bool CCounterSteeringExampleService::OnInitialize()
{
m_eStatus = sdv::EObjectStatus::initializing;
// Request the basic service for monitoring the alive counter.
m_pAliveCounterSvc = sdv::core::GetObject("Vehicle.Software.Application.IsActiveCounter_Service").GetInterface<vss::Vehicle::Software::Application::IsActiveCounterService::IVSS_SetCounter>();
if (!m_pAliveCounterSvc)
{
SDV_LOG_ERROR("Could not get interface 'IVSS_SetCounter': [CCounterSteeringExampleService]");
m_eStatus = sdv::EObjectStatus::initialization_failure;
return;
return false;
;
}
// Request the basic service for the rear axle.
@@ -31,8 +36,7 @@ void CCounterSteeringExampleService::Initialize(const sdv::u8string& /*ssObjectC
if (!m_pRearAxleSvc)
{
SDV_LOG_ERROR("Could not get interface 'IVSS_SetAngle': [CCounterSteeringExampleService]");
m_eStatus = sdv::EObjectStatus::initialization_failure;
return;
return false;
}
// Request the basic service for the steering wheel.
@@ -40,8 +44,7 @@ void CCounterSteeringExampleService::Initialize(const sdv::u8string& /*ssObjectC
if (!pSteeringWheelSvc)
{
SDV_LOG_ERROR("Could not get interface 'IVSS_SetSteeringAngle': [CCounterSteeringExampleService]");
m_eStatus = sdv::EObjectStatus::initialization_failure;
return;
return false;
}
// Request the basic service for the vehicle speed.
@@ -49,8 +52,7 @@ void CCounterSteeringExampleService::Initialize(const sdv::u8string& /*ssObjectC
if (!pVehSpeedSvc)
{
SDV_LOG_ERROR("Could not get interface 'IVSS_SetSpeed': [CCounterSteeringExampleService]");
m_eStatus = sdv::EObjectStatus::initialization_failure;
return;
return false;
}
// Register steering wheel change event handler.
@@ -64,26 +66,14 @@ void CCounterSteeringExampleService::Initialize(const sdv::u8string& /*ssObjectC
if (!m_Timer)
{
SDV_LOG_ERROR("CCounterSteeringExampleService: tasktimer with 10 milliseconds could not be created.");
m_eStatus = sdv::EObjectStatus::initialization_failure;
return;
return false;
}
SDV_LOG_INFO("CCounterSteeringExampleService: tasktimer created with 10 milliseconds");
m_eStatus = sdv::EObjectStatus::initialized;
return true;
}
sdv::EObjectStatus CCounterSteeringExampleService::GetStatus() const
{
return m_eStatus;
}
void CCounterSteeringExampleService::SetOperationMode(sdv::EOperationMode /*eMode*/)
{
// Not applicable
}
void CCounterSteeringExampleService::Shutdown()
void CCounterSteeringExampleService::OnShutdown()
{
// Terminate the alive counter
m_Timer.Reset();

View File

@@ -1,3 +1,13 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#ifndef COMPLEX_SERVICE_EXAMPLE_H
#define COMPLEX_SERVICE_EXAMPLE_H
@@ -35,7 +45,6 @@
*/
class CCounterSteeringExampleService :
public sdv::CSdvObject,
public sdv::IObjectControl,
public vss::Vehicle::Chassis::SteeringWheel::AngleService::IVSS_SetSteeringWheel_Event,
public vss::Vehicle::SpeedService::IVSS_SetSpeed_Event,
public ICounterSteeringService
@@ -53,39 +62,26 @@ public:
// Interface map
BEGIN_SDV_INTERFACE_MAP()
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::SteeringWheel::AngleService::IVSS_SetSteeringWheel_Event)
SDV_INTERFACE_ENTRY(vss::Vehicle::SpeedService::IVSS_SetSpeed_Event)
SDV_INTERFACE_ENTRY(ICounterSteeringService)
END_SDV_INTERFACE_MAP()
// Object declarations
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::ComplexService)
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::vehicle_function)
DECLARE_OBJECT_CLASS_NAME("Counter Steering Example Service")
DECLARE_OBJECT_SINGLETON()
/**
* @brief Initialize the object. Overload of sdv::IObjectControl::Initialize.
* @param[in] ssObjectConfig Optional configuration string.
* @brief Initialization event, called after object configuration was loaded. Overload of sdv::CSdvObject::OnInitialize.
* @return Returns 'true' when the initialization was successful, 'false' when not.
*/
void Initialize(const sdv::u8string& ssObjectConfig) override;
virtual bool OnInitialize() override;
/**
* @brief Get the current status of the object. Overload of sdv::IObjectControl::GetStatus.
* @return Return the current status of the object.
* @brief Shutdown the object. Overload of sdv::CSdvObject::OnShutdown.
*/
sdv::EObjectStatus GetStatus() const override;
/**
* @brief Set the component operation mode. Overload of sdv::IObjectControl::SetOperationMode.
* @param[in] eMode The operation mode, the component should run in.
*/
void SetOperationMode(sdv::EOperationMode eMode) override;
/**
* @brief Shutdown called before the object is destroyed. Overload of sdv::IObjectControl::Shutdown.
*/
void Shutdown() override;
virtual void OnShutdown() override;
/**
* @brief Set steering angle event. Overload of
@@ -136,7 +132,6 @@ private:
*/
void TimerFunction();
sdv::EObjectStatus m_eStatus = sdv::EObjectStatus::initialization_pending; ///< Current object status
volatile float m_fSteeringWheel = 0.0; ///< Steering wheel angle
volatile float m_fVehSpeed = 0.0; ///< Vehicle speed
volatile float m_fRearAxleAngle = 0.0; ///< Output rear angle

View File

@@ -1,10 +1,16 @@
/*******************************************************************************
* @file countersteering.idl
* @details Counter steering example service interface definition.
*/
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
/**
* @brief Counter steering example service interface. The interface provides functions for the
* @details Counter steering example service interface definition.
* counter steering example complex service.
*/
interface ICounterSteeringService

View File

@@ -1,3 +1,13 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
/**
* @file model.cpp
* @date 2025-04-16 09:03:47