Code Monkey home page Code Monkey logo

px4-jsbsim-bridge's Introduction

JSBSim Bridge

Build Tests

JSBSim bridge is a integration of the PX4 mavlink HIL interface to communicate with jsbsim

Installation (JSBSim)

JSBSim rolling releases is available in the release page of JSBSim

To have the visualization available, install flightgear.

apt install flightgear

Running the bridge

When run from the Firmware, an example can be run with the following

make px4_sitl jsbsim

To run without the flightgear visualization,

HEADLESS=1 make px4_sitl jsbsim

Running the bridge with ROS

Clone the px4-jsbsim-bridge package into your catkin workspace:

cd <path_to_catkin_ws>/src
git clone https://github.com/Auterion/px4-jsbsim-bridge.git

Build the jsbsim_bridge catkin package:

catkin build jsbsim_bridge

:::note You must have already set MAVROS in your workspace (if not, follow the instructions in the MAVROS installation guide). ::: To start JSBSim through ROS using the launch file as shown:

roslaunch jsbsim_bridge px4_jsbsim_bridge.launch

px4-jsbsim-bridge's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

px4-jsbsim-bridge's Issues

JSBSIM not found

Hi,
I succesfully compile and build JSBSim in Ubuntu 32 bit.

When I try to build PX4:
HEADLESS=1 make px4_sitl jsbsim_quadrotor_x
i got the message JSBSIM not found.

I have updated $PATH adding JSBSim directory ("/jsbsim/build/src") but this doesnt solve the problem.
Thanks for your help.

occasional failure to takeoff

When running the PX4 JSBSim bridge via make px4_sitl jsbsim on Ubuntu 18.04 and with QGroundControl connected, I'm finding that about every other attempt to takeoff after uploading a mission will fail with the drone falling out of the sky. When this happens the PX4 console outputs a poll timeout 0, 22 error and QGroundControl outputs a Critical failure detected: lockdown dialog.
px4_jsbsim_failure_to_takeoff

Error in make jsbsim in linux

1- I maked px4 master in Ubuntu Linux with this instrucction:
https://dev.px4.io/master/en/setup/dev_env_linux_ubuntu.html
2- then i dowloaded and installed jsbsim with this instruction:
JSBSim-devel_1.2.0.dev1-203.bionic.amd64.deb
https://dev.px4.io/master/en/setup/dev_env_linux_ubuntu.html
3- then i maked jsbsim with this command: make px4_sitl jsbsim
4- and receive this error :

[0/4] Performing build step for 'jsbsim_bridge'
[1/2] Building CXX object CMakeFiles/j...sim_bridge.dir/src/jsbsim_bridge.cpp.o
FAILED: CMakeFiles/jsbsim_bridge.dir/src/jsbsim_bridge.cpp.o 
/usr/bin/c++  -DJSBSIM_ROOT_DIR=\"/home/bayanlou/PX4-Autopilot/Tools/jsbsim_bridge\" -I/home/bayanlou/PX4-Autopilot/mavlink/include -I/usr/include/JSBSim -I/usr/include/eigen3 -I/home/bayanlou/PX4-Autopilot/Tools/jsbsim_bridge/include -std=c++14 -pthread   -Wno-address-of-packed-member --warn-uninitialized -MD -MT CMakeFiles/jsbsim_bridge.dir/src/jsbsim_bridge.cpp.o -MF CMakeFiles/jsbsim_bridge.dir/src/jsbsim_bridge.cpp.o.d -o CMakeFiles/jsbsim_bridge.dir/src/jsbsim_bridge.cpp.o -c /home/bayanlou/PX4-Autopilot/Tools/jsbsim_bridge/src/jsbsim_bridge.cpp
/home/bayanlou/PX4-Autopilot/Tools/jsbsim_bridge/src/jsbsim_bridge.cpp: In member function ‘bool JSBSimBridge::SetFdmConfigs(ConfigurationParser&)’:
/home/bayanlou/PX4-Autopilot/Tools/jsbsim_bridge/src/jsbsim_bridge.cpp:146:69: error: cannot convert ‘std::shared_ptr<JSBSim::FGInitialCondition>’ to ‘JSBSim::FGInitialCondition*’ in initialization
     JSBSim::FGInitialCondition *initial_condition = _fdmexec->GetIC();
                                                                     ^
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-address-of-packed-member’
ninja: build stopped: subcommand failed.
FAILED: external/Stamp/jsbsim_bridge/jsbsim_bridge-build 
cd /home/bayanlou/PX4-Autopilot/build/px4_sitl_default/build_jsbsim_bridge && /usr/bin/cmake --build .
ninja: build stopped: subcommand failed.
Makefile:224: recipe for target 'px4_sitl' failed
make: *** [px4_sitl] Error 1

plane can't runaway take off in HITL mode

I used the pr-hitl-support branch code, I show the detail:
the command as follows:
98638c5f8a6a0e4f517ab517b100e17
then the px4 connect the qgc via udp, I inserted those code to read the accel and gyro in the file of sensor_imu_plugin.cpp in realtime. Like this:
image
I load a fly plan into px4 and run the mission mode, but it can't runaway takeoff. And the accel and gyro data flow Like this:
0bcc2212f50244746a3d5cc8d3dfd13
I don't konw where the problem is.

"Airspeed sensor failure detected (1, -1)" after landing

When running the PX4 JSBSim bridge via make px4_sitl jsbsim on Ubuntu 18.04 and with QGroundControl connected, I'm seeing the PX4 console output a poll timeout 0, 22 error after completing a mission and landing, as well as a Airspeed sensor failure detected (1, -1) dialog inside QGroundControl. The view inside of FlightGear goes black and PX4 is unresponsive at this point and needs a restart before uploading another mission.
px4_jsbsim_error_on_land

ERROR [commander] Critical failure detected: lockdown

Problem Description
Trying to takeoff using the default rascal model results in a critical lockdown

To Reproduce

make px4_sitl jsbsim

Error Log:

INFO  [logger] Start file log (type: full)
INFO  [logger] [logger] ./log/2021-10-10/19_52_41.ulg	
INFO  [logger] Opened full log file: ./log/2021-10-10/19_52_41.ulg
INFO  [mavlink] MAVLink only on localhost (set param MAV_{i}_BROADCAST = 1 to enable network)
INFO  [mavlink] MAVLink only on localhost (set param MAV_{i}_BROADCAST = 1 to enable network)
INFO  [px4] Startup script returned successfully
pxh> INFO  [commander] Failsafe mode deactivated	
INFO  [tone_alarm] home set
INFO  [tone_alarm] notify negative

pxh> 
pxh> commander takeoff
pxh> INFO  [commander] Armed by internal command	
INFO  [navigator] Using minimum takeoff altitude: 20.00 m	
INFO  [fw_pos_control_l1] Takeoff on runway	
INFO  [commander] Takeoff detected	
ERROR [commander] Critical failure detected: lockdown	
INFO  [runway_takeoff] #Takeoff airspeed reached	
INFO  [commander] Disarmed by lockdown	
INFO  [logger] closed logfile, bytes written: 3148319
WARN  [ekf2] primary EKF changed 0 (gyro fault) -> 4

"Unable to start mission: Vehicle rejected arming." when taking off

When running the PX4 JSBSim bridge via make px4_sitl jsbsim on Ubuntu 18.04 and with QGroundControl connected, I get a error dialog stating Unable to start mission: Vehicle rejected arming. after uploading a mission and trying to take off. This doesn't seem to be fatal, as the mission can still proceed afterwards, but considering I don't see any options for arming/disarming inside QGroundControl, is there anything I can do about this error?
px4_jsbsim_error_on_takeoff

Flightgear visualization doesn't work in Ubuntu Focal

Description of issue
Flightgear visualization is not working on Ubuntu Focal and only displays the vehicle in a empty ocean. When the vehicle is in flight, the vehicle does not move even when PX4 is in flight.

image

When looking closer, I noticed the following error:

   11.00 [ALRT]:io         Error: version mismatch in FGNetNativeGUI2Props()
   11.00 [ALRT]:io              read 402653184 need 8
   11.00 [ALRT]:io              Need to upgrade net_fdm.hxx and recompile.

Posted Issue: JSBSim-Team/jsbsim#325

Loading a custom aircraft model to jsbsim bridge

Hello,
I have an aerodynamic model that I wrote in .XML format and I want to simulate it using the bridge, but I don't understand how.
I tried to copy the model's folder into a folder with the rest of the models that work (Rascal, Malolo, etc..), but when I try to run it the same way I run the others, it doesn't even recognize the model exists.

It is obvious I'm missing a few steps... can anyone please help?

JSBSim acceleration properties

I noticed you're using the following JSBSim properties as the ground truth acceleration values.

Eigen::Vector3d SensorImuPlugin::getAccelFromJSBSim() {
double x = _sim_ptr->GetPropertyValue("accelerations/a-pilot-x-ft_sec2");
double y = _sim_ptr->GetPropertyValue("accelerations/a-pilot-y-ft_sec2");
double z = _sim_ptr->GetPropertyValue("accelerations/a-pilot-z-ft_sec2");
return Eigen::Vector3d(ftToM(x), ftToM(y), ftToM(z));
}

However those aren't the accelerations of the aircraft's cg, they include additional accelerations based on the pilot's position relative to the cg and angular rates.

https://github.com/JSBSim-Team/jsbsim/blob/eccfd64bbe09fc209c399bead031a8ccc5873118/src/models/FGAuxiliary.cpp#L206-L212

Unless the model has the pilot's position coincident with the cg at all times or the overall effect is small enough particularly with small UAVs that you don't care. In terms of body rates you are using the body rates around the aircraft's cg.

The accelerations of the aircraft's cg can be retrieved via the following JSBSim properties:

https://github.com/JSBSim-Team/jsbsim/blob/eccfd64bbe09fc209c399bead031a8ccc5873118/src/models/FGAuxiliary.cpp#L338-L340

FAILED: external/Stamp/jsbsim_bridge/jsbsim_bridge-configure

I installed jsbsim git clone https://github.com/JSBSim-Team/jsbsim.git and build successfully
then I installed PX4 packages git clone https://github.com/PX4/PX4-Autopilot.git and then make px4_sitl has no error
but when I run make px4_sitl jsbsim for the jsbsim bridge with PX4 then the error came

make px4_sitl jsbsim
[0/6] Performing configure step for 'jsbsim_bridge'
-- /home/PX4-Autopilot/build/px4_sitl_default/mavlink
-- catkin DISABLED
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
/home/PX4-Autopilot/Tools/jsbsim_bridge/Boost_INCLUDE_DIR
used as include directory in directory /home/PX4-Autopilot/Tools/jsbsim_bridge

-- Configuring incomplete, errors occurred!
See also "/home/PX4-Autopilot/build/px4_sitl_default/build_jsbsim_bridge/CMakeFiles/CMakeOutput.log".
See also "/home/PX4-Autopilot/build/px4_sitl_default/build_jsbsim_bridge/CMakeFiles/CMakeError.log".
[1/6] Generating ../../logs
FAILED: external/Stamp/jsbsim_bridge/jsbsim_bridge-configure
cd /home/PX4-Autopilot/build/px4_sitl_default/build_jsbsim_bridge && /usr/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local -GNinja /home/PX4-Autopilot/Tools/jsbsim_bridge && /usr/bin/cmake -E touch /home/PX4-Autopilot/build/px4_sitl_default/external/Stamp/jsbsim_bridge/jsbsim_bridge-configure
ninja: build stopped: subcommand failed.
make: *** [Makefile:235: px4_sitl] Error 1

When I check the CMakeError.log
It is shown as

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/PX4-Autopilot/build/px4_sitl_default/build_jsbsim_bridge/CMakeFiles/CMakeTmp

Run Build Command(s):/bin/ninja cmTC_8af19 && [1/2] Building C object CMakeFiles/cmTC_8af19.dir/src.c.o
[2/2] Linking C executable cmTC_8af19
FAILED: cmTC_8af19
: && /bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -rdynamic CMakeFiles/cmTC_8af19.dir/src.c.o -o cmTC_8af19 && :
/bin/ld: CMakeFiles/cmTC_8af19.dir/src.c.o: in function main': src.c:(.text+0x46): undefined reference to pthread_create'
/bin/ld: src.c:(.text+0x52): undefined reference to pthread_detach' /bin/ld: src.c:(.text+0x63): undefined reference to pthread_join'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Source file was:
#include <pthread.h>

void* test_func(void* data)
{
return data;
}

int main(void)
{
pthread_t thread;
pthread_create(&thread, NULL, test_func, NULL);
pthread_detach(thread);
pthread_join(thread, NULL);
pthread_atfork(NULL, NULL, NULL);
pthread_exit(NULL);

return 0;
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/PX4-Autopilot/build/px4_sitl_default/build_jsbsim_bridge/CMakeFiles/CMakeTmp

Run Build Command(s):/bin/ninja cmTC_b4d1e && [1/2] Building C object CMakeFiles/cmTC_b4d1e.dir/CheckFunctionExists.c.o
[2/2] Linking C executable cmTC_b4d1e
FAILED: cmTC_b4d1e
: && /bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_b4d1e.dir/CheckFunctionExists.c.o -o cmTC_b4d1e -lpthreads && :
/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

I tried to remove and reinstall and also install repeatable but still getting same error

sudo apt-get remove/install libboost-all-dev

May I know the solution if anyone has the experience with this error?

RLException when calling roslaunch on jsbsim_bridge

I followed the instructions for running the bridge with ROS here. The bridge package appears to build correctly but when I go to launch it with:

roslaunch jsbsim_bridge px4_jsbsim_bridge.launch

I get the following output:

RLException: [px4_jsbsim_bridge.launch] is neither a launch file in package [jsbsim_bridge] nor is [jsbsim_bridge] a launch file name
The traceback for the exception was written to the log file

Does anybody know what could be going wrong here?

ENABLING HIL MODE IN JSBSIM BRIDGE

it seems like it is only sitl enabled. I have successfully enabled serial by changing mavlink tcp port to ttyACM0 in the configs file.
I want to enable HIL mode and serial communication at the same time. a little help would be appreciated. thanks

Error compiling PX4 sitl with JSBsim

Hi,

I’m compiling PX4 (v 1.12.3) for sitl with JSBsim on macOS 13.0.1 but I got the following error:

fatal error: variable ‘stat_thread’ set but not used [-Wunused-but-set-variable]

at step 343/815; I attach the complete terminal output to help in the solution of the issue.

PX4-SITL-error.pdf

Looking on the internet its seems a problem like this; this and this issues of other projects suggest that the solution is to suppress the warning; however, I don't know where I have to modify the code.

I opened a question on PX4 forum but still no solution. Can anyone help me?

My setup is:

px4 1.12.3
macOS 13.0.1
cmake 3.25.0
python 3.9.6
C and CXX compiler AppleClang 14.0.0.14000029
JSBsim 1.1.12

Many thanks

Nicolò

Failure to build jsbsim_bridge using catkin

Hello all!
I am currently trying to run the jsbsim simulation using the PX4 jsbsim bridge but during the bulid, one package fails.

input: "
$ catkin build jsbsim_bridge
"

output: "
Failed << jsbsim_bridge:make [ Exited with code 2 ]
Failed <<< jsbsim_bridge [ 1.4 seconds ]
[build] Summary: 4 of 5 packages succeeded.
[build] Ignored: 2 packages were skipped or are skiplisted.
[build] Warnings: None.
[build] Abandoned: None.
[build] Failed: 1 packages failed.
[build] Runtime: 3.9 seconds total. "

Please, can anyone shed some light as to why the build fails?
I am using ubuntu 18.04, I have followed "ROS with MAVROS installation guide" and used ROS melodic.

Here's the log (I hope it is the correct one)
build.make.log

Thanks!

JSBSim ERROR[simulator_mavlink]Number of simulated accelerometer out of range :Max:3

image
When I try to interface JSBSim with PX4 SITL, it reports an error in this picture. But it does not report error if I try more times. It seems like random appears.
I just use make px4_sitl jsbsim in the terminal. Also I can interface gazebo with PX4 SITL successfully. Anyone has the same problem?And anyone knows how to resolve this.

HITL, No GPS Lock for Vehicle over serial

I have followed the instructions from this PR to enable HITL support for JSB-Sim bridge and am able to connect to the JSBSim-bridge via serial port.
I am facing the following issue in HITL mode.
No GPS Lock for Vehicle :

Screenshot from 2022-11-03 18-30-16

I have selected the airplane configuration as HILStar (XPlane), on the cubepilot cubeorange ADSB module. I am using the PX4-Autopilot version 1.12.3.

Any suggestions ?

Custom quadrotor model

I am trying to add dj f450 model to px4 jsbsim bridge.

I have a jsbsim model that performed succesfully some test JSBSim-Team/jsbsim#333 and i would like now to bridge it to px4 sitl.
Dj f450 already exist as a PX4 copter example, so i guess that i need only to move all xml files to tools/jsbsim-bridge/models
For sure i need to interface correctely motor inputs to fcs commands coming from PX4 sitl . What esle do i need to do?
.Where i can find guidance or examples?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.