Skip to content

Commit

Permalink
space_Veins-0.2
Browse files Browse the repository at this point in the history
Changes:
- SGP4-based Satellite mobility purely written in C++
- The satellite mobility based on Skyfield is removed
- Bug fix: SatellitesConnectionManager does not crash anymore when
  a vehicle leaves the simulation
- Bug fix: several memory leaks
  • Loading branch information
m-franke committed Nov 18, 2021
1 parent 599462a commit 4251ae5
Show file tree
Hide file tree
Showing 52 changed files with 5,264 additions and 1,551 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ lib/python_skyfield/skyfield_protobuf_protocol.egg-info/
lib/skyfield_protobuf/skyfield_protobuf_protocol.egg-info/
__pycache__

build
tags

src/space_veins/base/satellitesConnectionManager/protobuf

export.sh
Expand Down
14 changes: 14 additions & 0 deletions LICENSES/NLPL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
NO LIMIT PUBLIC LICENSE
Version 0, June 2012

Gilles LAMIRAL
La Billais
35580 Baulon
France

NO LIMIT PUBLIC LICENSE

Terms and conditions for copying, distribution, modification
or anything else.

0. No limit to do anything with this work and this license.
46 changes: 18 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later

all: space_veins buildPythonSkyfield
all: space_veins
@echo 'space_Veins compiled successfully'

buildSpaceVeins_and_run_example: space_veins
cd examples/space_veins && ./run x-terminal-emulator -- -c WithoutBeaconing -u Cmdenv

run_example:
cd examples/space_veins && ./run x-terminal-emulator -- -c WithoutBeaconing -u Cmdenv
cd examples/space_veins && ./run -- -c WithoutBeaconing -u Cmdenv

run_dbg_example_gui: space_veins
cd examples/space_veins && ./run x-terminal-emulator -d --tool gdb -- -c WithoutBeaconing
cd examples/space_veins && ./run -d --tool gdb -- -c WithoutBeaconing

run_dbg_example_cmd: space_veins
cd examples/space_veins && ./run x-terminal-emulator -d --tool gdb -- -c WithoutBeaconing -u Cmdenv
cd examples/space_veins && ./run -d --tool gdb -- -c WithoutBeaconing -u Cmdenv

space_veins: checkmakefiles
space_veins: checkmakefiles checkConanFiles
cd src && $(MAKE) MODE=release -j4
cd src && $(MAKE) MODE=debug -j4

clean: checkmakefiles
cd src && $(MAKE) clean

conan_deps:
mkdir build && cd build && conan install --build=proj ..

cleanall: checkmakefiles
cd src && $(MAKE) MODE=release clean
cd src && $(MAKE) MODE=debug clean
rm -r src/space_veins/base/satellitesConnectionManager/protobuf
rm -f src/Makefile
rm -rf out/
rm -rf build/

makefiles:
@echo
Expand All @@ -54,22 +54,12 @@ checkmakefiles:
exit 1; \
fi

cleanPythonSkyfield:
@echo 'Clean python skyfield'
@rm -rf lib/skyfield_protobuf/skyfield_protobuf_protocol.egg-info/
@rm -rf lib/python_skyfield/.venv/
@rm -f lib/skyfield_protobuf/MANIFEST
@rm -rf lib/skyfield_protobuf/dist/
@rm -rf lib/skyfield_protobuf/skyfield_protobuf/

skyfieldProtobufPackage:
@echo 'Build skyfield_protobuf package.'
@cd lib/skyfield_protobuf && python3 setup.py sdist

buildPythonSkyfield: cleanPythonSkyfield skyfieldProtobufPackage lib/python_skyfield/Pipfile.lock
@echo 'Build Skyfield python environment'
@cd lib/python_skyfield && pipenv sync

lib/python_skyfield/Pipfile.lock: lib/python_skyfield/Pipfile
@echo 'Create Pipfile.lock'
@cd lib/python_skyfield && pipenv lock
checkConanFiles:
@if [ ! -d build ]; then \
echo; \
echo '======================================================================='; \
echo 'build/ does not exist. Please use "make conan_deps" to generate it!'; \
echo '======================================================================='; \
echo; \
exit 1; \
fi
9 changes: 9 additions & 0 deletions conanfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[requires]
proj/8.1.1

[generators]
make

[options]
proj:with_tiff=False
proj:with_curl=False
58 changes: 0 additions & 58 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ if sys.version_info[0] == 2:
# Option handling
parser = OptionParser()
parser.add_option('--veins', dest='veins', default='../veins', help='Path to Veins library')
#parser.add_option('--etsimsg', dest='etsi', default=None, help='Path to Etsi Messages library')
#parser.add_option('--lara', dest='lara', default=None, help='Path to Veins Lanradio Extension library')
parser.add_option('--protobuf', dest='protobuf', default='lib/skyfield_protobuf/', help='Path to skyfield_protobuf sources')
(options, args) = parser.parse_args()

if args:
Expand All @@ -39,7 +36,6 @@ makemake_flags = [
'-I', '.',
'-o', proj_name,
'-O', '../out',
# for veins
'-I', '../{}/src'.format(options.veins), # use '..' because cwd is going to be src.
'-L', '../{}/src/'.format(options.veins),
'-lveins$(D)',
Expand All @@ -57,28 +53,6 @@ run_imgs = [
os.path.join(options.veins, 'images'),
]

# if options.etsi is not None and options.lara is not None:
# makemake_flags.extend([
# # for lanradio (including etsi-messages)
# '-I', '../{}/include'.format(options.etsi),
# '-L', '../{}/'.format(options.etsi),
# '-letsimsg',
# '-I', '../{}/src/'.format(options.lara),
# '-L', '../{}/src/'.format(options.lara),
# '-lveins_lara$(D)',
# ])
# run_libs.extend([
# '{}/src/veins_lara'.format(options.lara),
# ])
# run_neds.extend([
# '{}/src/veins_lara'.format(options.lara),
# ])
# run_imgs.extend([
# os.path.join(options.lara, 'images'),
# ])
# else:
# warning("ETSI and/or LANRadio not specified, not linking against those!")

# Start creating files
if not os.path.isdir('out'):
os.mkdir('out')
Expand All @@ -89,38 +63,6 @@ f.write('run_neds = %s\n' % repr(run_neds))
f.write('run_imgs = %s\n' % repr(run_imgs))
f.close()

# compile protobuf proto files
proto_cppout = 'src/space_veins/base/satellitesConnectionManager/protobuf'
proto_source_dirs = [
# add paths to proto files here
"{}/protobuf".format(options.protobuf),
]
if not os.path.isdir(proto_cppout):
os.mkdir(proto_cppout)
for proto_source in proto_source_dirs:
protoc_flags = ['--proto_path', proto_source, '--cpp_out', proto_cppout]
# recursivly find proto files
protoc_files = [
os.path.join(path, fname)
for (path, _, fnames) in os.walk(proto_source)
for fname in fnames
if fname.endswith('.proto')
]
subprocess.check_call(['env', 'protoc'] + protoc_flags + protoc_files)

# Fix includes of generated protobuf source files.
with open(os.getcwd() + "/src/space_veins/base/satellitesConnectionManager/protobuf/skyfield_protobuf/satellite.pb.cc", "r") as file:
data = file.readlines()
data[3] ="#include \"space_veins/base/satellitesConnectionManager/protobuf/skyfield_protobuf/satellite.pb.h\"\n"
with open(os.getcwd() + "/src/space_veins/base/satellitesConnectionManager/protobuf/skyfield_protobuf/satellite.pb.cc", "w") as file:
file.writelines(data)

with open(os.getcwd() + "/src/space_veins/base/satellitesConnectionManager/protobuf/skyfield_protobuf/simulation.pb.cc", "r") as file:
data = file.readlines()
data[3] ="#include \"space_veins/base/satellitesConnectionManager/protobuf/skyfield_protobuf/simulation.pb.h\"\n"
with open(os.getcwd() + "/src/space_veins/base/satellitesConnectionManager/protobuf/skyfield_protobuf/simulation.pb.cc", "w") as file:
file.writelines(data)

subprocess.check_call(['env', 'opp_makemake'] + makemake_flags, cwd='src')

info('Configure done. You can now run "make".')
4 changes: 0 additions & 4 deletions dependencies.txt

This file was deleted.

12 changes: 4 additions & 8 deletions examples/space_veins/README
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
space_Veins tutorial example.

This simulation requires veins_launchd to be started and listening for
connections on a TCP socket, e.g. using "~/src/veins/bin/veins_launchd -vv".
The satellites' mobility requires TLE data. You can download it
on e.g., https://celestrak.com/NORAD/elements/

The TLE data required to start the example is not shipped with space_Veins
because of unclear copyrights. However, TLE data is available in the Internet,
e.g., at <https://celestrak.com>.

To actually run the example have a look at the Makefile in the space_Veins
root directory.
Copy the tle data of a single satellite in the lines 61-63
of the omnetpp.ini file and uncomment these lines.
3 changes: 2 additions & 1 deletion examples/space_veins/RSUExampleScenario.ned
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import org.car2x.veins.modules.mobility.traci.TraCIScenarioManagerForker;

import space_veins.nodes.Satellite;
import space_veins.base.satellitesConnectionManager.SatellitesConnectionManager;
import space_veins.modules.mobility.traci.TraCIScenarioManagerSatelliteCompatibleForker;

network RSUExampleScenario
{
Expand All @@ -61,7 +62,7 @@ network RSUExampleScenario
playgroundSizeZ = playgroundSizeZ;
@display("p=30,0;i=misc/globe");
}
manager: TraCIScenarioManagerForker {
manager: TraCIScenarioManagerSatelliteCompatibleForker {
parameters:
@display("p=512,128");
}
Expand Down
20 changes: 11 additions & 9 deletions examples/space_veins/omnetpp.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cmdenv-express-mode = false
cmdenv-autoflush = true
cmdenv-status-frequency = 1s
cmdenv-log-prefix = "%l %C: "
**.cmdenv-log-level = trace
**.cmdenv-log-level = debug
#cmdenv-redirect-output = true
#cmdenv-output-file = "omnetpp.log"

Expand All @@ -19,7 +19,7 @@ network = RSUExampleScenario
debug-on-errors = true
print-undisposed = true

sim-time-limit = 200s
sim-time-limit = 400s

**.scalar-recording = true
**.vector-recording = true
Expand Down Expand Up @@ -53,9 +53,14 @@ sim-time-limit = 200s
# #
# #
##########################################################
*.satellite[0].spaceveinsmobility.x = 0
*.satellite[0].spaceveinsmobility.y = 0
*.satellite[0].spaceveinsmobility.z = 3
*.satellite[0].satelliteMobility.x = 0
*.satellite[0].satelliteMobility.y = 0
*.satellite[0].satelliteMobility.z = 3

### --------> ADD TLE DATA HERE <-----------------
#*.satellite[0].satelliteMobility.satelliteName = ""
#*.satellite[0].satelliteMobility.tle_line_one = ""
#*.satellite[0].satelliteMobility.tle_line_two = ""

#*.satellite[0].nic.satelliteMac.txPower = 1000mW
# maximum transmit power of a SpaceX user terminal 4060mW according to https://apps.fcc.gov/els/GetAtt.html?id=259301
Expand All @@ -79,16 +84,13 @@ sim-time-limit = 200s
*.satellite[0].nic.satellitePhy.antennaOffsetZ = 1.895 m

*.satellite[0].applType = "SatelliteApplLayer"
#*.satellite[0].satelliteName = "ISS (ZARYA)"
#*.satellite[0].satelliteName = "STARLINK-2687"
*.satellite[0].satelliteName = "STARLINK-1528"

*.satellitesConnectionManager.sendDirect = true
*.satellitesConnectionManager.maxInterfDist = 2600m
# minAltitudeAngle according to spaceX-transmitPower-antennaGain-elevationAngle.pdf
# minAltitudeAngle according to https://apps.fcc.gov/els/GetAtt.html?id=259301
*.satellitesConnectionManager.minAltitudeAngle = 25deg
*.satellitesConnectionManager.drawMaxIntfDist = false
*.satellitesConnectionManager.satelliteName = "ISS (ZARYA)"

*.node[0].appl.transmitSatelliteMsg = true

Expand Down
19 changes: 0 additions & 19 deletions lib/python_skyfield/Pipfile

This file was deleted.

Loading

0 comments on commit 4251ae5

Please sign in to comment.