PX4 / jMAVSim

Simple multirotor simulator with MAVLink protocol support
BSD 3-Clause "New" or "Revised" License
82 stars 207 forks source link

adding new peripheral class as a container for simulator and activating simulated buzzer code #92

Closed catch-twenty-two closed 4 years ago

catch-twenty-two commented 5 years ago

This revisits and finishes up the ability to receive a tone alarm over mavlink from the px4 simulator. There is a corresponding px4 pr that implements sending the message here:

https://github.com/PX4/Firmware/pull/11431

In addition this pr also adds a new peripheral class which can be modified to add leds, gimbals, other buzzers and any other simulated peripheral that would be a benefit.

Original concept/prototype demonstration is here (this pr adds same functionality):

https://www.youtube.com/watch?v=t7cvCfbbXbE

mcsauder commented 4 years ago

@catch-twenty-two , would you resolve the conflicts in this PR so that I can test it? Thanks!

mcsauder commented 4 years ago

@catch-twenty-two , I've applied your changes in this PR to the current jMAVSim master branch and I get exceptions thrown from the modified code:

Exception in Simulator.world.update() : 
java.lang.NullPointerException
    at me.drton.jmavsim.MAVLinkHILSystem.handleMessage(MAVLinkHILSystem.java:145)
    at me.drton.jmavsim.MAVLinkConnection.sendMessage(MAVLinkConnection.java:36)
    at me.drton.jmavsim.MAVLinkNode.sendMessage(MAVLinkNode.java:29)
    at me.drton.jmavsim.UDPMavLinkPort.update(UDPMavLinkPort.java:147)
    at me.drton.jmavsim.MAVLinkConnection.update(MAVLinkConnection.java:44)
    at me.drton.jmavsim.World.update(World.java:33)
    at me.drton.jmavsim.Simulator.run(Simulator.java:510)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Line 145 where the exception occurs is where filterMessage() is being called: vehicle.getPeripherials().getBuzzer().filterMessage(msg);

Could you deconflict/rebase this PR so that I try to validate your work? Thanks!

-Mark

mcsauder commented 4 years ago

@catch-twenty-two , should we try to resolve the conflicts in this PR or close it out?

catch-twenty-two commented 4 years ago

@mcsauder closing this for now, maybe Ill revisit it some other time