Giter Site home page Giter Site logo

open-dis / open-dis-cpp Goto Github PK

View Code? Open in Web Editor NEW
80.0 10.0 64.0 12.72 MB

C++ implementation of the IEEE-1278.1 Distributed Interactive Simulation (DIS) application protocol v6 and v7

License: BSD 2-Clause "Simplified" License

Lua 0.05% C++ 99.32% CMake 0.63%
dis protocol simulation-framework library

open-dis-cpp's Introduction

open-dis-cpp

A C++ implementation of the Distributed Interactive Simulation (DIS) application protocol IEEE-1278.

Note: This code base was originally auto generated with xmlpg.

Travis (Linux) Build Status Build status CodeDocs status

Building Open DIS

  • CMake is required to build the platform specific projects. It can be downloaded and installed from http://cmake.org/

  • SDL2 and SDL2_net are required libraries to compile the examples. These can usually be install via Linux package managers. More details, and instructions for Windows are included below.

    NOTE: Windows users will need to either add the DLL folders to their path, or copy the DLLs to the output directory (Debug).

OpenDIS Build Options

The OpenDIS build system accepts several build options to control compilation. The following options are available:

  • BUILD_SHARED_LIBS - Boolean value to specify whether to build OpenDIS libraries as shared (ON/TRUE) or static (OFF/FALSE). Default is ON.
  • BUILD_EXAMPLES - Boolean value to specify whether to build example sender/receiver applications. Default is OFF.
  • BUILD_TESTS - Boolean value to specify whether to build unit tests. Default is OFF.

Example application build options. Only valid if BUILD_EXAMPLES is enabled.

  • SDL2_PATH - Installation path of SDL2
  • SDL2_NET_PATH - Installation path of SDL2_net

These options are passed to cmake as arguments. Example: cmake -DBUILD_SHARED_LIBS=ON -DBUILD_EXAMPLES=ON ..

Linux / GNU Makefiles

  1. Run mkdir build
  2. Run cd build
  3. Run cmake ..
  4. Optionally, -DCMAKE_INSTALL_PREFIX=<custom-path-to-install> to set a custom directory to install the bin, include, and lib output directories.
  5. Run make - this will output the libOpenDIS6.so, and libOpenDIS7.so libraries in the build directory along with the Example Applications.
  6. The below steps are optional
  7. Run make package to build Linux package files. Currently this will produce a Red Hat RPM package, Debian DEB package, and 2 compressed tarball (XZ, GZ).
  8. Run make install to install bin, lib, and dir, into CMAKE_INSTALL_PREFIX WARNING: CMAKE_INSTALL_PREFIX default can to somewhere /usr/local/, if not specified with the -D flag as shown in Step 3.1. If you're unsure where to install, and want to keep your /usr/local/ directory clean, run cmake .. -DCMAKE_INSTALL_PREFIX=./install. This will cause make install to create a local install directory, from which you can move files elsewhere at a later date.

Windows with Visual Studio

  1. Open CMake (cmake-gui) via the the start menu.
  2. Enter the open-dis-cpp directory path into the Source and Build fields.
  3. Click the + Add Entry button and enter the following details: Name: SDL2_PATH Type: PATH Value: <SDL2-install-folder> (if you follow the below SDL2 Windows Install Instruction this will be C:/SDL2)
  4. Click the + Add Entry button and enter the following details: Name: SDL2_NET_PATH Type: PATH Value: <SDL2-install-folder> (if you follow the below SDL2 Windows Install Instruction this will be C:/SDL2)
  5. Click the + Add Entry button and enter the following details: Name: CMAKE_LIBRARY_ARCHITECTURE Type: STRING Value: x64 (64 bit) or x86 (32 bit)
  6. Click Configure and follow the prompts, selecting the correct generator (i.e. Visual Studio version).
  7. Click Generate
  8. Click Open Project - This should open the generates solution file in Visual Studio
  9. Build the Solution (Ctrl + Shift + B)

These steps were tested with Visual Studio 16 2019 (Community Edition). Currently, only OpenDIS 6 and the Example Applications compile. The library and executable files are output to a Debug directory.

To run the executables, either the value of the SDL2_PATH/lib/CMAKE_LIBRARY_ARCHITECUTRE should be added to your path, or SDL2.dll and SDL2_net.dll need to be copied to the Debug directory.

Cleaning CMake files

To quickly clean up CMake output files, use git clean -xdf. Note: Use with care if you are actually developing open-dis-cpp, as git clean removes untracked files.

Old Pre-make build instructions

  • premake5 is required to build the platform specific projects. Download it and make sure it's available on your path, or specify the path to it.

Linux / GNU Makefiles

  1. Run premake5 gmake
  2. Run make config=release

Windows with Visual Studio 2015

  1. Run premake5 vs2015
  2. Open the solution and build.

Developer Docs

The latest doxygen docs for the Open DIS master branch can be found here.

SDL2 and SDL2_net Install Instructions

Linux Package Managers

Arch: sudo pacman -S sdl2 sdl2_net

Fedora: sudo dnf install SDL2-devel SDL2_net-devel

Ubuntu: sudo apt-get install libsdl2-dev libsdl2-net-dev

If you're unable to install the correct packages, try installing from source

Windows Install Instructions

These are the installation steps that have been tested with open-dis-cpp, however there are other methods for installation. Experienced users should feel free to customise their install.

(Core) SDL2 Instructions

  1. Navigate to the SDL2 Download page, and download the latest Development Libraries.

    Alternatively, the version tested with open-dis-cpp, 2.0.12-VC, can be downloaded from this direct link.

  2. Extract the SDL2-devel-2.0.12-VC.zip file directly to your C:\.

  3. Rename the resulting SDL2-2.0.12 folder to SDL2.

  4. Add C:\SDL2\lib\x64 to your System Path for 64-bit systems, or add C:\SDL2\lib\x86 for 32-bit systems.

SDL2_net Instructions

  1. Navigate to the SDL2_net project page, and download the latest Development Libraries.

    Alternatively, the version tested with open-dis-cpp, 2.0.1-VC, can be downloaded from this direct link.

  2. Extract the SDL2-devel-2.0.12-VC.zip

  3. Copy the include and lib directories from the resulting folder into you C:\SDL2\ folder

POSIX Source Installation

(Core) SDL2

Run the following commands:

  1. wget http://libsdl.org/release/SDL2-2.0.12.tar.gz

    Or, Download via your favourite web browser.

    NOTE: check the download page for new releases

  2. tar -xvf SDL2-2.0.9.tar.gz

  3. pushd SDL2-2.0.9/

  4. ./configure --prefix=/usr && make && sudo make install

  5. popd

SDL2_net

  1. wget https://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.0.1.tar.gz

    Or, Download via your favourite web browser.

    NOTE: check https://www.libsdl.org/projects/SDL_net page for new releases

  2. tar -xvf SDL2_net-2.0.1.tar.gz

  3. pushd SDL2_net-2.0.1/

  4. ./configure --prefix=/usr && make && sudo make install

  5. popd

open-dis-cpp's People

Contributors

a7marchesini avatar crhowell3 avatar dilavni avatar huell-howitzer avatar intothevoid avatar leif81 avatar mcgredonps avatar phoppermann avatar plata avatar rodneyp290 avatar semihkurt avatar shadow88s avatar swither avatar vilasfe avatar wadehunk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

open-dis-cpp's Issues

SEGFAULT without extra processor

OpenDIS segfaults on IncomingMessage::SwitchOnType (called by IncomingMessage::Process). Have come across this once on Windows and once on RHEL. First was while processing the DetonationPdu on Windows and second time was while processing EntityStatePdu on RHEL. (Using DIS6)

void IncomingMessage::SwitchOnType(DIS::PDUType pdu_type, DataStream& ds)
{
Pdu *pdu = NULL;
PduBankContainer::iterator containerIter;
// first, check if any custom PDU bank registered
PduBankContainer::iterator pduBankIt = _pduBanks.find(pdu_type);
if (pduBankIt != _pduBanks.end())
{
pdu = pduBankIt->second->GetStaticPDU(pdu_type, ds);
} else
{
pdu = PduBank::GetStaticPDU(pdu_type);
}
// if valid pdu point, and at least 1 processor
if (pdu && (_processors.count(pdu_type) > 0))
{
pdu->unmarshal( ds );
// assumes the location in the buffer is the packet id.
typedef std::pair<PacketProcessorContainer::iterator,PacketProcessorContainer::iterator> RangePair;
RangePair rangepair = _processors.equal_range( pdu_type );
PacketProcessorContainer::iterator processor_iter = rangepair.first;
PacketProcessorContainer::iterator processor_end = rangepair.second;
while( processor_iter != processor_end )
{
(processor_iter->second)->Process( *pdu );
++processor_iter;
}
}
else
{
ds.clear();
}
}

The problem was fixed when adding another processor leading me to believe somewhere the ->second reference is reading off the end, but I have not looked into the specifics. It was always the last processor that failed and I do not believe those two messages were to blame but wanted to note it.

Replace HawkNL in examples

I'm not terribly familiar with the HawkNL library, but from what I can tell it used to be very popular, but looks to be no longer maintained and fallen out of popularity. So to get the Examples code compiling we may want to pick a replacement library.

I don't do much C++ dev these days, so I'm out of the loop in terms of what people actually use, but a couple potential replacement options that may be suitable are Boost (Asio) and SDL2 (SDL_net).

http://www.boost.org/doc/libs/1_64_0/doc/html/boost_asio.html
https://www.libsdl.org/projects/SDL_net/

Issues following dis6 versus dis7

I am trying to better understand the dis6 and dis7 implementations, but there appears to be a lot of overlap or duplication or things missing from one to the other.

My original thought was to create a common directory that would hold all the classes that are common to both versions, but have hit some roadblocks.

An an example would be the PDU header. the main difference i see is a variable that is padding in dis6 (uint16), but the same amount of bits is split into two variables in dis7 ( 2 x unint8). someone implemented a superclass in dis7 which PduHeader inherits and fills in the changed parameters, and the correct change in the dis6 code would be to have it inherit the same superclass and only add the padding. This is the direction that seemed to make sense until I hit places where the names have been changed. There appears to be classes that exist in dis6, and not in dis7 and vice versa, some appear to be name changes. e.g. Orientation versus EulerAngles. (although not sure about that one being a naming or duplication issue)

The problem that I have run into is that the reference document I am looking at to compare the versions is incomplete. siso document v6 vd v7

I thought this might be an issue with the underlying xml specification that generated the original code? I tried to decipher it, but I am not sure which tool generated this c++ code?

Any help or direction is appreciated.

building and running the tests

The test directory has some test code in it, but the instructions are very vague.
it references cppunit, and set the path for cppunit.

It doesn't appear there are any build instructions.

how how would it be to add this to the cmake and enable a test variable?

is anyone using using the test directory?

Issues building with open dis

Hi there. My team and I are trying to use the examples given to build our own project but every time we try to implement anything within open like the DIS::IncomingMessages we get the following error:

"unresolved external symbol "__declspec(dllimport) ..."

We have all the header files in our project, linked OpenDIS.lib and copied OpenDIS.dll to the project folder. Are we missing something or is this a known issue when trying to build inside a project?

DataStream missing

When compiling, I get "fatal error: 'DIS/DataStream.h' file not found" and if I "touch DIS/DataStream.h" I get multiple "error: unknown type name 'DataStream'"

CMake Build Pull Requests - Discussion

I saw the recent CMake Pull Request #35, and after seeing @leif81's comments and questions, as well as the previously unaccepted CMake pull request #33, I thought it would be useful to create an issue for it to be discussed.
One query from Lief was if CMake worked well with Visual Studio, and in the past I have found it was quite well across platforms.
The second query was if CMake is typically verbose?
This is were I'm a little unsure on an answer because I'm kind of a CMake newbie myself, and I originally though it wasn't so verbose.
My impression is that it depends what you want it to do, and I'm hoping that is what this issue can clarify.
Here is a simplistic 50 line CMakeLists.txt that I wrote up a while back.
It creates 2 separate libraries OpenDIS7 & OpenDIS6, and 2 executable files using ExampleSender & ExampleReciever.
It also includes an install target that puts the libraries in an ${CMAKE_INSTALL_PREFIX}/lib, executables in ${CMAKE_INSTALL_PREFIX}/bin, and copies the head files to ``${CMAKE_INSTALL_PREFIX}/include. the ${CMAKE_INSTALL_PREFIX}` defaults to `/usr/local/` on my linux system, however it can be redirected by setting it in the cmake command. So building and installing might look something like this (Assuming the attached CMakeList.txt is in the root directory of open-dis-cpp)

cd open-dis-cpp
mkdir build 
cd build
cmake -DCMAKE_INSTALL_PREFIX=/alternate/install/path/
make install # adding sudo if needed

However, some issues with my simplistic CMakeList.txt include:

  • it doesn't check that you have dependencies such as SDL/SDL_net for the examples like #35
  • it doesn't use CPACK to a deb (#35) , or rpm (#33) package file
  • it doesn't separate the utils into a separate library like both #33 & #35
  • it doesn't separate the utils into a separate library like both #33 & #35
  • it doesn't have/create the necessary *Config.cmake files that enable easy inclusion in other CMake projects like both #33 & #35

So to sum up I think they needs to be a discussion, and decision on what requirements of the build system are, before a CMakeList.txt file is merged.

example usage of std::vector<OneByteChunk>

I have what feels like a dumb question.

I want to populate a variable length PDU SignalPdu with "fake" data and test it out.

e.g. I want to send an array of Ints, or 1 int for now.

I know that 1 int should get packed into a char array of size 4, int32 would be four bytes where each byte is an instance of OneByteChunk in the std::vector which should then be of size 4.

I am confused how to do this, and any help would be appreciated.

Variable Datum in DIS7

Hello,

In DIS7/VariableDatum.h, variableDatumBits is an unsigned int instead of std::vector<EightByteChunk>

/** Variable datum. This can be any number of bits long, depending on the datum. */
  unsigned int _variableDatumBits; 

it looks like DIS7/VariableDatium.cpp uses DIS/VariableDatum.h, so looks like this code isn't event compiling.

Thanks for your work!

Alias targets set in config file cause cmake error when package is found more than once

In my application, it's perfectly reasonable for, say, two different calls to find_dependency(OpenDIS) to be made, which in turn causes OpenDISConfig.cmake to be included twice. This is a bit of a problem, since then

## Add target aliases
add_library(OpenDIS::DIS6 ALIAS OpenDIS::OpenDIS6)
add_library(OpenDIS::DIS7 ALIAS OpenDIS::OpenDIS7)

## These are deprecated target names. All new references to the targets
## should utilize the new namespace wrapped version
add_library(OpenDIS6 ALIAS OpenDIS::OpenDIS6)
add_library(OpenDIS7 ALIAS OpenDIS::OpenDIS7)

gets run twice. The proposed fix is very straightforward, merely checking whether each target exists before creating it:

## Add target aliases
if (NOT TARGET OpenDIS::DIS6)
  add_library(OpenDIS::DIS6 ALIAS OpenDIS::OpenDIS6)
endif()
if (NOT TARGET OpenDIS::DIS7)
  add_library(OpenDIS::DIS7 ALIAS OpenDIS::OpenDIS7)
endif()

## These are deprecated target names. All new references to the targets
## should utilize the new namespace wrapped version
if (NOT TARGET OpenDIS6)
  add_library(OpenDIS6 ALIAS OpenDIS::OpenDIS6)
endif()
if (NOT TARGET OpenDIS7)
  add_library(OpenDIS7 ALIAS OpenDIS::OpenDIS7)
endif()

Ubuntu 20.04 package issue

Hello. I am able to run make without any issues, both .so files and examples build. However, when I try to run make package, cmake errors trying to build the RPM file. Is there a package that needs to be installed in order to continue?

Operating System: Ubuntu 20.04.3 LTS
Kernel: Linux 5.11.0-37-generic
Architecture: x86-64`
$ make package
[ 43%] Built target OpenDIS6
[ 44%] Built target ExampleReceiver
[ 46%] Built target ExampleSender
[100%] Built target OpenDIS7
Run CPack packaging tool...
CPack: Create package using DEB
CPack: Install projects
CPack: - Run preinstall target for: OpenDIS
CPack: - Install project: OpenDIS []
CPack: Create package
-- CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.
CPack: - package: /home/test/Desktop/open-dis-cpp/build/OpenDis-1.0.0.x86_64.deb generated.
CPack: Create package using RPM
CPack: Install projects
CPack: - Run preinstall target for: OpenDIS
CPack: - Install project: OpenDIS []
CPack: Create package
CMake Error at /usr/share/cmake-3.16/Modules/Internal/CPack/CPackRPM.cmake:774 (message):
  RPM package requires rpmbuild executable
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/Internal/CPack/CPackRPM.cmake:1879 (cpack_rpm_generate_package)

CPack Error: Error while execution CPackRPM.cmake
CPack Error: Problem compressing the directory
CPack Error: Error when generating package: OpenDis
make: *** [Makefile:141: package] Error 1

Issue with Data Length unmarshalling

There is an issue related with the unmarshal function in incomingMessage if the dis packet is malformed.
Application crashes with some udp packets with malformed lenght field.

In concrete it seems that occurs if the lenght is greater than expected at this location:

void Pdu::unmarshal(DataStream& dataStream)
{
dataStream >> _protocolVersion;
dataStream >> _exerciseID;
dataStream >> _pduType;
dataStream >> _protocolFamily;
dataStream >> _timestamp;
dataStream >> _length; // <----- length malformed , greater than expected
dataStream >> _padding;
}

After this code execution, the exectution continues in the final class (i.e. EntityStatePdu::unmarshall) and the application crashes. I think It is because the malformed length, as it seems to be used en EntityStatePdu...

This is an example of a udp packet causing a crash: 0x020001020000001d2500167374642d7363616e....

DIS7 - SetDataPdu - Access to _variableDatums

How can I access to the raw data inside the variable datum? Looking at the code I am a little confused.
I mean SetDataPdu contains a std::vector and I can access to it but inside the VariableDatum I found the following

 /** Type of variable datum to be transmitted. 32 bit enumeration defined in EBV */
  unsigned int _variableDatumID; 

  /** Length, in bits, of the variable datum. */
  unsigned int _variableDatumLength; 

  /** Variable datum. This can be any number of bits long, depending on the datum. */
  unsigned int _variableDatumBits; 

  /** padding to put the record on a 64 bit boundary */
  unsigned int _padding; 

  // Variable Data
  std::vector<EightByteChunk> _variableDatums;

Looking on the standard, AFAIK or let me say as far as I understand, I don't see reference to EightByteChunk _variableDatums even if you marshal and unmarshall it, but no accessor method are provided....
Am I missing something?
How does it is supposed to be used?
For Java impl a getVariableData method exist, here (c++) how can I access the same data?

Also the getMarshalledSize seems to be wrong.

C++ looks like:

marshalSize = marshalSize + 4;  // _variableDatumID
marshalSize = marshalSize + 4;  // _variableDatumLength
marshalSize = marshalSize + 4;  // _variableDatumBits
marshalSize = marshalSize + 4;  // _padding

Java looks like:

marshalSize = marshalSize + 4;  // variableDatumID
marshalSize = marshalSize + 4;  // variableDatumLength
marshalSize = marshalSize + payload.length; // payload length
marshalSize = marshalSize + padding.length; // padding

For c++ seems we can add only 4 bytes....
Regards

When will DIS7 be fully functional?

I know there has been a lot of churn in the DIS7 implementation in recent months, but when is this anticipated to be fully DIS7 compliant? Thank you

Linux build instructions fail

DESCRIBE THE BUG

Linux build instructions fail.

STEPS TO REPRODUCE

Steps to reproduce the behaviour:

  1. Clone the repo.
  2. Put premake5 in a folder included in $PATH environment variable.
  3. Run premake5 gmake in repo root directory.
  4. Run make config=release and observe error.

EXPECTED BEHAVIOUR

Make command succeeds.

ACTUAL BEHAVIOUR

Make fails fatally due to undocumented dependency in example code.

SCREENSHOTS

image

ENVIRONMENT

  • OS: Pop_OS! 18.04

Error while building DIS7 Win10 - mingw730_64

Hello,

I'm trying to build library in DIS7 on Win10 with mingw730_64 and have the following error :

src/dis7/VariableDatum.cpp:61:35: error: '_variableDatums' was not declared in this scope

Indeed, the variable _variableDatums is not declared in the header file and not initialize in the constructor.

After adding it in both file, i have an other error :

src/dis7/VariableDatum.cpp:66:9: error: 'EightByteChunk' was not declared in this scope

The header variableDatum.h don't include 'EightByteChunk'

After adding it, I have the following error :

src/dis7/VariableDatum.cpp:66:47: error: conversion from 'const value_type {aka const char}' to non-scalar type 'DIS::EightByteChunk' requested
EightByteChunk x = _variableDatums[idx];

Do you have any idea, how to fix it ?

I suggest you to add an appVeyor for your continuous integration indeed, you only test it on Linux with DIS6.

I have no problem with the DIS6
Thanks for your work !

Signal PDU misinterpretation

void SignalPdu::unmarshal(DataStream& dataStream)
{
RadioCommunicationsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first
dataStream >> _encodingScheme;
dataStream >> _tdlType;
dataStream >> _sampleRate;
dataStream >> _dataLength;
dataStream >> _samples;
_data.clear();
for(size_t idx = 0; idx < _dataLength; idx++)
{
OneByteChunk x;
x.unmarshal(dataStream);
_data.push_back(x);
}
}

There are multiple errors here. First of all "_dataLength" in interpreted incorrectly as bytes, when it's in fact bits / or a constant value when using the encoding scheme for database index.

From the standard: (emphasis added): "Data Length - This field shall specify the number of bits of digital voice audio or digital data being sent in this Signal PDU. This field shall be represented by a 16-bit unsigned integer. If the Encoding Class is database index, the Data Length field shall contain the value 96."

Also: "Data - This field shall specify the audio or digital data conveyed by the radio transmission. The interpretation of the Data field depends on the value of the Encoding Scheme (see 5.4.8.2(d)) and TDL Type (see 5.4.8.2(e)) fields."

How does error manifest itself? Basically you're trying to read/unmarshal too much data (8 times). If you have defined large enough buffer for DataStream, this problem goes undetected, but the extra data will be trash (just the contents of the read buffer). If you have a buffer sized according to the incoming PDU, this will cause undefined behaviour. Essentially DataStream will index over it's buffer.

There are similar problems in marshal. Data length f.e. will be encoded incorrectly.

Rework PDUBank handling

Currently, the PDUBank (and thus the available PDUs) is hardcoded in

Pdu *pdu = PduBank::GetStaticPDU(enumType);

As a consequence, it is not possible to use a different PDUBank without changing the code. However, this is required e.g. to use DIS 7 PDUs.

I suggest to implement the PDUBank handling in a similar way to the PacketProcessors, i.e.

  • make a PDUBank base class with a method Pdu* GetStaticPDU(const DataStream&) const
  • register the desired PDUBank implementation similar to IncomingMessage::AddProcessor

This would also help reducing the cyclic dependencies between the PDUs and the utils.

EntityStatePdu wrong marshalled size calculation (number of articulation parameters)

Inside the implementation of EntityStatePdu I discovered that the marshalled size of the PDU is calculated assuming to be present always only one articulation parameter. This is true for DIS6 and DIS7.

{
   int marshalSize = 0;

   marshalSize = EntityInformationFamilyPdu::getMarshalledSize();
   marshalSize = marshalSize + _entityID.getMarshalledSize();  // _entityID
   marshalSize = marshalSize + 1;  // _forceId
   marshalSize = marshalSize + 1;  // _numberOfArticulationParameters
   marshalSize = marshalSize + _entityType.getMarshalledSize();  // _entityType
   marshalSize = marshalSize + _alternativeEntityType.getMarshalledSize();  // _alternativeEntityType
   marshalSize = marshalSize + _entityLinearVelocity.getMarshalledSize();  // _entityLinearVelocity
   marshalSize = marshalSize + _entityLocation.getMarshalledSize();  // _entityLocation
   marshalSize = marshalSize + _entityOrientation.getMarshalledSize();  // _entityOrientation
   marshalSize = marshalSize + 4;  // _entityAppearance
   marshalSize = marshalSize + _deadReckoningParameters.getMarshalledSize();  // _deadReckoningParameters
   marshalSize = marshalSize + _marking.getMarshalledSize();  // _marking
   marshalSize = marshalSize + 4;  // _capabilities

   for(unsigned long long idx=0; idx < _articulationParameters.size(); idx++)
   {
        ArticulationParameter listElement = _articulationParameters[idx];
        marshalSize = marshalSize + listElement.getMarshalledSize();
    }

    return marshalSize;
}

As is possible to see the number of articulation parameters is stubbed to one when instead it should be _articulationParameters.size().

Create release version

Would be nice to have a versioned release of open-dis-cpp to support configuration management use cases for users of the library. Would recommend using semantic versioning to capture API breakages.

Build packages (e.g. RPM/DEB)

There should be 3 packages:

  • utils
  • dis6 (requires utils)
  • dis7 (requires utils)

I'm not sure if/how this is possible with premake. An alternative would be CMake (CPack).

These packages could then also be released via GitHub releases.

TransmitterPDU is missing on dis7

TransmitterPdu is missing on include/dis7 though it is not deprecated in DIS 7 officially . In addition to this, it exists on Java repository OpenDIS Java.

I am implementing DIS by using this repository thanks to you, I realized that something is missing in Radio Transmission part because newly added PDUs does not completely represent Radio Transmission. Then I found DIS6 vs DIS7 PDF and it seemsTransmitterPdu has not been deprecated on DIS 7.

I also realized that if any Developer wants to use DIS 7:

  1. They have to update classes inside Utils folder so I suggest that Utils folder should be created inside dis7 and dis6 folders.
  2. They have to add missing PDUs on DIS 6 to DIS 7 project and update them.
  3. They need to update TransmitterPDU for DIS 7 use (ex: RadioEntityType becomes RadioType on dis7 and some other details.)

If you can grant me access on some branch, I can work on that branch and make a pull request to you.

Issue with Data Length

void SignalPdu::marshal(DataStream &dataStream) const {
  RadioCommunicationsFamilyPdu::marshal(
      dataStream); // Marshal information in superclass first
  dataStream << _encodingScheme;
  dataStream << _tdlType;
  dataStream << _sampleRate;
  dataStream << (short)_data.size();  // ISSUE
  dataStream << _samples;
  for (auto byte : _data) {
    dataStream << byte;
  }
}

There is an issue related to the PDUs that inherit from the RadioCommunicationsFamilyPdu (the IntercomSignalPdu and SignalPdu classes) where the size of the data being marshaled into the datastream is incorrect and not compliant with the DIS Standard. The data length should be the size of the data in bits (as per the SISO-STD-001-2015 standard), whereas the size being marshaled in currently is in bytes. I will open a PR to fix this issue.

It is possible that this issue is present elsewhere in the code, so I will do a once-over before requesting merge.

Compile warnings because singed/unsigned integer comparisons.

DESCRIBE THE BUG

Unsigned/Signed integer compare compile warning.

STEPS TO REPRODUCE

Steps to reproduce the behavior:

  1. Clone the repo
  2. Put premake5 in a folder included in $PATH environment variable.
  3. Run premake5 gmake in repo root directory.
  4. Run make config=release and observe compile errors.

EXPECTED BEHAVIOUR

Make works without error or warning.

ACTUAL BEHAVIOUR

Multiple minor compile warnings are raised.

SCREENSHOTS

image

ENVIRONMENT

  • OS: Pop_OS! 18.04

RECOMMENDED FIX

ctrl-h over the source code and change "for( int idx" to "for( std::size_t idx". This would fix a lot of them. Obviously, care would need to be taken with each case to make sure the general change is correct in each instance.

IFF PDU is missing on both DIS 6 and DIS 7

Hello,

Thanks for your contribution. As in my company needs DIS implementation, I currently work on DIS by using repository. When I encounter with some missing PDUs, I wanted to contribute as well.

According to these two documents from SISO, there should be IFF PDU:

  1. DIS v6-v7

  2. DIS Overview v7

I've already opened a pull request after I completely finish the PDU.

I am open any comments or reviews.
Thanks,

passing std::vector<ArticulatedPart> by ref in EntityStatePdu setter function.

I'm having trouble passing a std::vector from a QT project to the setter function by reference. compiling the projects with C++14 and MSVC 2019 Debug mode.

These are the functions I'm trying to use from the EntityStatePdu class:
std::vector& getArticulationParameters();
const std::vector& getArticulationParameters() const;
void setArticulationParameters(const std::vector& pX);

When I pass a std::vector variable from QT, it seems to have a different binary layout on MSVC.
Could it possibly be a compiler option that I have to match with OpenDIS in order to pass the same std::vector?

opendis6_export.h and opendis7_export.h missing

nearly everything contains one of these headers files "opendis6_export.h" and "opendis7_export.h"
but those header files do not exist in src directories, or any other directory that I've looked into.
Won't compile without them. If you comment out the include, then there are even more errors, because that's where symbols had been defined.

building open-dis-cpp with cmake

I want to build open-dis ccp dis6 source as a shared library. I don't need examples.
I am building on a machine that has cmake and most everything needed for development.
If this build is going to need more than I can not install that, need to work with what I have, which should be enough
anyhow, can I please have an example of linux command line to cmake and build

i tried ..
cmake -BUILD_SHARED_LIBS=ON -DBUILD_EXAMPLES=OFF -S src
(I'm sunning that in a directory that contains src/dis6, src/dis7 CMakeLists.txt
I tried using cmake3 as well
cmake -h doesn't help much :)
Do I need to make entries in CMakeLists?
I assumed, just download, install, and do cmake -S -B and turn on SHARED_LIBS,
but so far isn't working.
thanks

How to build example with DIS version 7

I tried building the Receiver-Example with DIS version 7. In order to do this I changed the target_link_libraries from OpenDIS6 to OpenDIS7. Furthermore I changed the Includes for the EntityStatePdu from #include <dis6/EntityStatePdu.h> to #include <dis7/EntityStatePdu.h> in EntityStatePduProcessor.h and main_receive.cpp.
When I try to build, I get an error about "type redefinition" of DIS::Pdu. In my opinion this makes sense, since there is still the Include #include <dis6/utils/IncomingMessage.h>. That include references dis6/Pdu.h.

What exactly am I doing wrong? How can I change the example to use DIS version 7?

Update OneByteChunk Class

void OneByteChunk::setOtherParameters(const char* x)
{
for(int i = 0; i < 1; i++)
{
_otherParameters[i] = x[i];
}
}
void OneByteChunk::marshal(DataStream& dataStream) const
{
for(size_t idx = 0; idx < 1; idx++)
{
dataStream << _otherParameters[idx];
}
}
void OneByteChunk::unmarshal(DataStream& dataStream)
{
for(size_t idx = 0; idx < 1; idx++)
{
dataStream >> _otherParameters[idx];
}
}

Why have character arrays that will only ever contain a single character? Why use character arrays at all? A single character would suffice. There is no need to have these arrays that are "iterated" over. Seems very arbitrary and overly complicated. Will probably create a PR to update this, unless there is a justifiable reason to leave it the way it is.

Unclear software structure

To me, the structure of the software is a bit unclear:

  • The files in DIS7 are including <DIS/...>. This is probably not intended.
  • The directories in cpp and CppUtils are both called DIS. What will happen if a file with the same name exists in both directories (i.e. #include <DIS/...> might easily include the wrong file)?

As a result of this: How should, in your opinion, open-dis-cpp be installed for development on a Linux system?

In my opinion, these issues could be solved by:

  • Use CMake for building
  • Use CPack to build RPM/ZIP etc.
  • Build 3 packages: utils, dis6, dis7 (install header files to: /usr/include/open-dis/utils, /usr/include/open-dis/dis6, /usr/include/open-dis/dis7)
  • Restructure directories such that above package structure is represented (โ†’ #include <DIS/...> becomes #include <open-dis/dis6/...>)

IFFPdu bug on SystemIdentifier.h and SystemIdentifier.cpp

I tried to implement the IFFPdu, but it failed to form a correct stream. I managed to identify the issue with the code.
Under SystemIdentifier _systemMode shall be 8-bit, but it is defined as a unsigned short (16bit).
The correct declaration should be :

unsigned char _systemMode;

and corresponding gets and sets should change accordingly.

Google Style Formatting

          "I am considering applying Google Style Guide formatting to the code base for modern C++ style compliance, though I do not want to overstep my bounds."

Originally posted by @crhowell3 in #80 (comment)

Now that the OneByteChunk class has been refactored, I'd like to implement some clang-format and Google Style Guide compliance to this repository to clean up and modernize this code base without affecting the overall intent and functionality.

Can't be compile

it seems some files are missing.
eg: DIS/msLibMacro.h can't be found.
DIS/SyntheticEnvironmentFamilyPdu.h

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.