Exemple #1
0
def setupSimulator(skydelIpAddress, simInstanceID, skydelEngineLatencyMs,
                   hilTjoin, radioType, radioAddress, uniqueRadioId):
    sim = skydelsdx.RemoteSimulator()
    sim.setVerbose(True)
    sim.connect(skydelIpAddress, simInstanceID)

    # Check the engine latency (Skydel's system wide preference)
    if sim.call(GetEngineLatency()).latency() != skydelEngineLatencyMs:
        #sim.call(SetEngineLatency(skydelEngineLatencyMs))  # Uncomment this line to set the engine latency preference
        error(
            "Please execute the SetEngineLatency({0}) command or change the skydelEngineLatencyMs value before executing this script."
            .format(skydelEngineLatencyMs))

    # Check the streaming buffer preference, do not change it from its default value
    if sim.call(GetStreamingBuffer()).size() != 200:
        error("Please do not change the Streaming Buffer preference.")

    # Uncomment these lines if you do very low latency HIL, as these features can impact Skydel's performance (Skydel's system wide preferences)
    # sim.call(ShowMapAnalysis(False))
    # sim.call(SetSpectrumVisible(False))

    # Create new config, ignore the default config if it's set
    sim.call(New(True, False))

    # Change the output
    sim.call(
        SetModulationTarget(
            radioType, "",
            radioAddress if radioType in ["X300", "N310"] else "", True,
            uniqueRadioId))
    sim.call(
        ChangeModulationTargetSignals(0, 12500000, 100000000, "UpperL", "L1CA",
                                      -1, False, uniqueRadioId))

    # Enable some logging
    sim.call(
        EnableLogRaw(False)
    )  # You can enable raw logging and compare the logs (the receiver position is especially helpful)
    sim.call(
        EnableLogHILInput(False)
    )  # This will give you exactly what Skydel has received through the HIL interface

    # Change the vehicle's trajectory to HIL
    sim.call(SetVehicleTrajectory("HIL"))

    # HIL Tjoin is a volatile parameter that must be set before every HIL simulation
    sim.call(SetHilTjoin(hilTjoin))

    # The streaming check is performed at the end of pushEcefNed. It's recommended to disable this check
    # and do it asynchronously outside of the while loop when sending positions at high frequencies.
    sim.setHilStreamingCheckEnabled(True)

    return sim
Exemple #2
0
  def _generateEnu(self, elapsedTime):
    time = elapsedTime / 1000.0
    posOnCircle = time*CircleTrajectory.SPEED/CircleTrajectory.RADIUS
    e = math.cos(posOnCircle) * CircleTrajectory.RADIUS
    n = math.sin(posOnCircle) * CircleTrajectory.RADIUS
    return Enu(e, n, 0)

  def send(self, duration):
    origin = Lla(toRadian(CircleTrajectory.LAT), toRadian(CircleTrajectory.LON), CircleTrajectory.ALT)
    for i in range(0,duration*100):
      elapsedTime = 10 * i   # time in msec
      enu = self._generateEnu(elapsedTime)
      self.sim.pushTrackLla(elapsedTime, origin.addEnu(enu))

# Connect
sim = skydelsdx.RemoteSimulator()
sim.setVerbose(True)
sim.connect(HOST)

# Create new config
sim.call(New(True))

# Change configuration before starting the simulation
sim.call(SetModulationTarget("NoneRT", "", "", True, "uniqueId"))
sim.call(ChangeModulationTargetSignals(0, 12500000, 100000000, "UpperL", "L1CA", -1, False, "uniqueId"))
sim.call(EnableLogRaw(True))

# Create a track (trajectory) for the vehicle
sim.call(SetVehicleTrajectory("Track"))
sim.beginTrackDefinition()
trajectory = CircleTrajectory(sim)
Exemple #3
0
import skydelsdx
from skydelsdx.commands import SetModulationTarget
from skydelsdx.commands import ChangeModulationTargetSignals
from skydelsdx.commands import SetVehicleTrajectoryCircular
from skydelsdx.commands import SetGpsStartTime
from skydelsdx.commands import Start
from skydelsdx.commands import SetPowerForSV
from skydelsdx.commands import ResetAllSatPower
from skydelsdx.commands import Stop
from skydelsdx.commands import New
from skydelsdx.commands import Open
from skydelsdx.commands import GetSimulatorState

# Connect
#sim = skydelsdx.RemoteSimulator(True) #Stop the script with an exception if a command fails (automatic failure handling)
sim = skydelsdx.RemoteSimulator(False) #Does not stop the script with an exception if a command fails (manual failure handling)
sim.setVerbose(True) 
sim.connect() #same as sim.connect("localhost")

sim.call(New(True)) 

# Change configuration before starting the simulation
sim.call(SetModulationTarget("NoneRT", "", "", True, "uniqueId"))
sim.call(ChangeModulationTargetSignals(0, 12500000, 100000000, "UpperL", "L1CA", -1, False, "uniqueId"))

# The following command is not allowed before you start the simulation.
# Error message will be displayed
result = sim.call(SetPowerForSV("GPS", 12, -10, True))
print(result.getMessage())

# Start the simulation