Enable Hardware-In-The-Loop simulation for JSBSim#28
Conversation
9f4a187 to
7a7aff1
Compare
97bb7de to
411ee67
Compare
| int getRealtimeFactor() { return _realtime_factor; } | ||
| bool getSerialEnabled() { return _serial_enabled; } | ||
| int getBaudrate() { return _baudrate; } | ||
| std::string getDevice() { return _device; } |
There was a problem hiding this comment.
| std::string getDevice() { return _device; } | |
| const std::string& getDevice() const { return _device; } |
| } | ||
|
|
||
| bool JSBSimBridge::SetMavlinkInterfaceConfigs(std::unique_ptr<MavlinkInterface> &interface, TiXmlHandle &config) { | ||
| bool JSBSimBridge::SetMavlinkInterfaceConfigs(std::unique_ptr<MavlinkInterface> &interface, ConfigurationParser &cfg) { |
There was a problem hiding this comment.
| bool JSBSimBridge::SetMavlinkInterfaceConfigs(std::unique_ptr<MavlinkInterface> &interface, ConfigurationParser &cfg) { | |
| bool JSBSimBridge::SetMavlinkInterfaceConfigs(std::unique_ptr<MavlinkInterface> &interface, const ConfigurationParser &cfg) { |
|
|
||
| bool JSBSimBridge::SetMavlinkInterfaceConfigs(std::unique_ptr<MavlinkInterface> &interface, TiXmlHandle &config) { | ||
| bool JSBSimBridge::SetMavlinkInterfaceConfigs(std::unique_ptr<MavlinkInterface> &interface, ConfigurationParser &cfg) { | ||
| TiXmlHandle config = *cfg.XmlHandle(); |
There was a problem hiding this comment.
| TiXmlHandle config = *cfg.XmlHandle(); | |
| const TiXmlHandle& config = *cfg.XmlHandle(); |
|
|
||
| // Receive and handle actuator controls | ||
| _mavlink_interface->pollForMAVLinkMessages(); | ||
| bool hil_mode_ = true; |
d12eef0 to
774fa81
Compare
This commit adds configuration options for running HITL simulation with the PX4 JSBSim bridge The device path / baudrate can be passed with the command line flag -d and -b. The bridge is configured to be run by HITL when the -d is provided. the baudrate is configured to be 921600 by default Enable HITL on mavlink interface This PR enables HITL on the mavlink interface Handle gcs udp port in config file
774fa81 to
a6faffc
Compare
Co-authored-by: Beat Küng <beat-kueng@gmx.net>
|
@Jaeyoung-Lim . Hi I am interested in running HITL with JSBSim bridge, Can you please guide me with the steps to follow for this. any help will be highly appreciated. |
|
@fahadmaqbool16 The pull request already explains how to test this PR, what additional information do you need? |
|
@Jaeyoung-Lim thanks for your reply, when I run
Nothing happens. |
|
@fahadmaqbool16 If you read the PR description, your command does not match what I have described Also your log says that what you tried to execute is a directory, therefore it is expected that nothing happens |
|
No, actually I was changing the directory to Tools to see if the command works, but it didn't. To clarify, I am
in the Tools directory, I get the error
if this command is not correct, can you please tell the correct command, |
|
Hi, My bad, I was running the command in the Tools directory, now I am able to make the jsbsim bridge work by running that command (HEADLESS=1 ./jsbsim_bridge rascal -d /dev/ttyACM0 -s ~/src/Firmware/Tools/jsbsim_bridge/scene/LSZH.xml) from within the build directory (/PX4-Autopilot/build/px4_sitl_default/build_jsbsim_bridge). My pixhawk is detected on the serial port as shown in the image below. QGC is also able to connect with pixhawk but i am unable to arm the vehicle as the vehicle launch position is not showing in QGC. running dmesg in the MAVLINK console shows the follwing output. PS: I replaced the px4_jsbsim_bridge files from this repo. (https://github.com/Auterion/px4-jsbsim-bridge/tree/f88764b091a8f5bc5f98893f07c63b56682a1420) |
@fahadmaqbool16 You can't do that it only works with this specific branch |
| interface->SetSerialEnabled(cfg.getSerialEnabled()); | ||
| interface->SetDevice(cfg.getDevice()); | ||
| interface->SetBaudrate(cfg.getBaudrate()); | ||
| interface->SetHILStateLevel(true); |
There was a problem hiding this comment.
interface->SetHILStateLevel(false); this fixes GPS Lock issue
There was a problem hiding this comment.
std::shared_ptrJSBSim::FGInitialCondition initial_condition = _fdmexec->GetIC();



Describe problem solved by this pull request
Currently the
px4-jsbsim-bridgecan only be used to run Software-In-The-Loop(SITL) simulations. While this is useful for evaluating the software changes in firmware, it may not reveal issues that may appear only deployed on hardware. PX4 also supports Hardware-In-The-Loop(HITL) simulation. However, this was not exposed to the jsbsim-bridgeDescribe your solution
This commit adds configuration options for running HITL simulation with the PX4 JSBSim bridge.
The device path / baudrate can be passed with the command line when running the binary directly with flag
-dand-b.e.g.
or to set the baudrate
The bridge is configured to be run with a HITL when the device path
-dis provided. The baudrate is configured to be921600by default, but can be also configured through a-bflag.Test data / coverage
WIP
Additional context