Upgrading from SDK 2023.x to 2024.x
This guide provides instructions on upgrading an existing SDK 2023.x based project to SDK 2024.x.
Base Component Include Path and Namespace
What Changed
- The base components (
Base
, EventsBase
, Managed
, etc) have been moved from openjaus/core_v1_1
to openjaus/Components
.
- The base components have been moved from the
openjaus::core_v1_1
namespace to the openjaus::components
namespace.
How to Migrate
- Change the
#include
directive from #include <openjaus/core_v1_1/{BaseComponent Header File}
to openjaus/Components/{BaseComponent Header File}
.
- Change the namespace from
openjaus::core_v1_1::{BaseComponent Class Name}
to openjaus::components::{BaseComponent Class Name}
.
Example
In 2023.x
| // .h file
#include <openjaus/core_v1_1/Base.h>
class MyComponent :
public virtual openjaus::mobility_v1_0::services::GlobalPoseSensor,
public openjaus::core_v1_1::Base
public:
MyComponent(const std::string& name);
~MyComponent() override = default;
// ...
}
|
In 2024.x
| // .h file
#include <openjaus/Components/Base.h>
class MyComponent :
public virtual openjaus::mobility_v1_0::services::GlobalPoseSensor,
public openjaus::components::Base
public:
MyComponent(const std::string& name);
~MyComponent() override = default;
// ...
}
|
Message and Field Structure
What Changed
- The structure of messages, internal events, and fields were updated to exactly match the JSIDL.
- This means that all messages now contain a top-level
Record
, Sequence
, List
, or Variant
element and some elements that were previously directly accessible are now nested within a Record
, Sequence
, List
, or Variant
.
How to Migrate
- Update any code that accesses the elements of a message to match the updated structure.
Example
In 2023.x
| mobility_v1_0::ReportGlobalPose reportGlobalPose;
reportGlobalPose.setPresenceVector(mobility_v1_0::ReportGlobalPose::PV_NO_FIELDS);
reportGlobalPose.enableLatitude();
reportGlobalPose.setLatitude_deg(currentPosition.latitude_deg);
reportGlobalPose.enableLongitude();
reportGlobalPose.setLongitude_deg(currentPosition.longitude_deg);
|
In 2024.x
| mobility_v1_0::ReportGlobalPose reportGlobalPose;
auto& reportGlobalPoseRec = reportGlobalPose.getReportGlobalPoseRec();
reportGlobalPoseRec.setPresenceVector(mobility_v1_0::ReportGlobalPose::GlobalPoseRec::PV_NO_FIELDS);
reportGlobalPoseRec.enableLatitude();
reportGlobalPoseRec.setLatitude_deg(currentPosition.latitude_deg);
reportGlobalPoseRec.enableLongitude();
reportGlobalPoseRec.setLongitude_deg(currentPosition.longitude_deg);
|
Nested Subfield Classes
What Changed
- Message and field subfields are declared as nested classes.
- This means that subfield class types can be accessed using the nested class notation (
Class::Nested1::Nested2
).
- While more verbose, this change allows for better organization and encapsulation of the message and field subfields.
- Subfield classes are still defined in separate files, but their location is less obvious due to reuse.
How to Migrate
- Update any code that accesses the subfields of a field or message to use the nested classes.
Example
In 2023.x
| manipulator_v2_0::ReportJointPosition reportJointPosition;
auto& jointPositionList = reportJointPosition.getJointPositionList();
manipulator_v2_0::JointPositionRecord jointPositionRec;
// Populate jointPositionRec
jointPositionList.add(jointPositionRec);
|
In 2024.x
| manipulator_v2_0::ReportJointPosition reportJointPosition;
auto& jointPositionList = reportJointPosition.getJointPositionList();
manipulator_v2_0::ReportJointPosition::JointPositionList::JointPositionRec jointPositionRec;
// Populate jointPositionRec
jointPositionList.add(jointPositionRec);
|
IOP Addressing Support
What Changed
- The IOP specific base components (
IopBase
, IopEventsBase
, IopManaged
) have been removed.
- IOP addressing support is added to a component through the use of an
AddressProvider
class using the setAddressProvider
method.
How to Migrate
- Replace the use of an IOP specific base component with a standard base component.
- Add an IOP Address Provider instance to the Component class.
- Set the Address Provider in the Component constructor.
Example
In 2023.x
| // .h file
#include <openjaus/iop_v3/IopBase.h>
class MyComponent :
public virtual openjaus::mobility_v1_0::services::GlobalPoseSensor,
public openjaus::iop_v3::IopBase
public:
MyComponent(const std::string& name);
~MyComponent() override = default;
// ...
}
// .cpp file
// Nothing to be done
|
In 2024.x
| // .h file
#include <openjaus/Components/Base.h>
#include <openjaus/iop_v3/AddressProvider.h>
class MyComponent :
public virtual openjaus::mobility_v1_0::services::GlobalPoseSensor,
public openjaus::components::Base
public:
MyComponent(const std::string& name);
~MyComponent() override = default;
// ...
private:
openjaus::iop_v3::AddressProvider m_addressProvider;
}
// .cpp file
MyComponent::MyComponent(const std::string& name) :
Base(name),
m_addressProvider(this)
{
setAddressProvider(&m_addressProvider);
// ...
}
|