-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSBSim interface to Matlab on Windows: throttle command from joystick doesn't work #931
Comments
If In terms of the throttle, double-check that the engine is running. Script You can also use the following in the reset file to ensure that the engines are all started and running. <running> -1 </running> |
Dear @seanmcleod Thanks for your answer! I thought that the moment will be generated when throttle command is for example set to 1 (after some time), for example when the plane have to take-off. In such case, all velocities are equal to zero at the beginning, and after some time, aileron and/оr elevator commands will affect plane's behavior. I have tested now new script model c172_cruise_8K.xml (there is event engine start in it). As in previous model I have to modify one row: I have made modification within the reset xml file as you suggested. <?xml version="1.0"?>
<initialize name="reset01">
<!--
This file sets up the aircraft to start off
from the runway in preparation for takeoff.
-->
<ubody> 0.0 </ubody>
<vbody> 0.0 </vbody>
<wbody> 0.0 </wbody>
<latitude unit="DEG"> 47.0 </latitude>
<longitude unit="DEG"> 122.0 </longitude>
<phi> 0.0 </phi>
<theta> 0.0 </theta>
<psi unit="DEG"> 150.0 </psi>
<altitude> 1000.00 </altitude>
<hwind> 0.0 </hwind>
<xwind> 0.0 </xwind>
<vt> 0.0 </vt>
<gamma unit="DEG"> 3.0 </gamma>
<running> -1 </running>
</initialize> You can see my S-function block now: Joystick commands are given bellow: And again, results are the same: It seems like the engine still won't start. Kind regards, |
Have you seen it working if you use the default 737 example? Also, is the State Vector you're showing definitely being updated as opposed to just showing the initial state? Look at the first 3 elements of the State Vector, they represent the UVW velocities in fps, and all 3 are non-zero. So if they're non-zero, whether the engine is running or not over time the aircraft's lat/lon will change. |
Yes, I have checked with the default 737 example, but the results are the same. I have looked the first 3 elements and it has sense what you are saying. There should be the change over time for lateral/lon as well. Maybe I used non-adequate values for plot, I really don't understand. <?xml version="1.0"?>
<s_function_config>
<input>
<property> fcs/throttle-cmd-norm </property>
<property> fcs/aileron-cmd-norm </property>
<property> fcs/elevator-cmd-norm </property>
<property> fcs/rudder-cmd-norm </property>
<property> fcs/mixture-cmd-norm[0] </property>
<property> propulsion/engine[0]/set-running </property>
<property> fcs/flap-cmd-norm </property>
<property> gear/gear-cmd-norm </property>
</input>
<outputs>
<output name="State">
<property> velocities/u-fps </property>
<property> velocities/v-fps </property>
<property> velocities/w-fps </property>
<property> velocities/p-rad_sec </property>
<property> velocities/q-rad_sec </property>
<property> velocities/r-rad_sec </property>
<property> position/h-sl-ft </property>
<property> position/long-gc-deg </property>
<property> position/lat-gc-deg </property>
<property> attitude/phi-rad </property>
<property> attitude/theta-rad </property>
<property> attitude/psi-rad </property>
</output>
<output name="Control">
<property> fcs/throttle-pos-norm[0] </property>
<property> fcs/left-aileron-pos-rad </property>
<property> fcs/right-aileron-pos-rad </property>
<property> fcs/elevator-pos-norm </property>
<property> fcs/rudder-pos-norm </property>
<property> fcs/flap-pos-norm </property>
<property> fcs/speedbrake-pos-norm </property>
<property> fcs/spoiler-pos-norm </property>
<property> gear/gear-cmd-norm </property>
</output>
<output name="Pilot">
<property> forces/load-factor </property>
<property> aero/alpha-rad </property>
<property> aero/alphadot-rad_sec </property>
<property> aero/beta-rad </property>
<property> aero/betadot-rad_sec </property>
<property> velocities/vc-fps </property>
<property> velocities/vc-kts </property>
<property> velocities/vtrue-fps </property>
<property> velocities/vg-fps </property>
<property> velocities/mach </property>
<property> velocities/h-dot-fps </property>
<property> aero/qbar-psf </property>
<property> fcs/elevator-cmd-norm </property>
</output>
</outputs>
<!--This is an optional parameter-->
<!--The only properties in this should be atmosphere related-->
<!--
<weather>
<property> atmosphere/wind-north-fps </property>
</weather>
-->
</s_function_config> Maybe I have to express these two values in another reference frame to see these changes properly. As I can see these are long-gc-deg, and lon-gc-deg, while the reference frame within the Simulink block is inertial and it requires data in meters. I have found that the problem is probably in the difference between reference frames. |
I'd suggest that you add the property
Also note that:
|
Hello guys!
I have downloaded and installed on Windows the [JSBSim release v1.1.13]. I have decided for this simulation framework because I can easily configure fixed-wing planes (with my own parameters) which I want to test without the need for modelling aircraft dynamics from the ground. Furthermore, I plan to use this software for the following tasks:
Firstly, I have placed some blocks necessary for receiving commands from the joystick.
After that, I have added blocks for simulating fixed-wing UAV within the Unreal Engine environment.
I have tried to simulate flight on c172p by using the following files within the S-function block:
In order to do this, I had to modify one row in c1772.xml file (script file) as this:
<use aircraft="c172p" initialize="reset01"/>
I have figured out that plane only responds to aileron and/оr elevator commands when I set vt value to be non zero, as well as initial altitude for example to be 1000 ft (these values need to be set in "reset01.xml" file). However, model doesn't react on throttle input, and therefore state variables (position/long-gc-deg and position/lat-gc-deg) have the same values as given within the initial "reset01.xml" file. The mentioned variables can be seen bellow:
Commands from the joystick can be seen bellow:
Does anybody know why throttle command cannot be seen by the model, or did I miss something in preparing my Simulink model?
Thanks in advance!
Kind regards,
Đorđe Jevtić
Ph.D. student & Junior Research Assistant
This repository's issues are reserved for feature requests and bug reports. Issues that are neither bug reports or feature requests will be transferred to Discussions by the team and the issue will be locked and closed.
I'm submitting a ...
Describe the issue
What is the current behavior?
What is the expected behavior?
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
Other information
The text was updated successfully, but these errors were encountered: