SITL Building issues

Hello,

I’m having some issues with the SITL simulation. I’m not sure how I broke it, but somehow I have. It was working previously. Without reinstalling ubuntu and starting from scratch, I’m stumped on how to fix this.

When I run this command “make px4_sitl_default gazebo” I get this message (note I killed it at the end after the real error):

sk@sk-Precision-5520:~/Firmware$ make px4_sitl_default gazebo
[2/6] Performing configure step for 'sitl_gazebo'
-- install-prefix: /usr/local
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   system
--   thread
--   timer
--   filesystem
--   chrono
--   date_time
--   atomic
-- Boost version: 1.58.0
-- Building klt_feature_tracker without catkin
-- Building OpticalFlow with OpenCV
-- catkin DISABLED
Gazebo version: 7.0
-- Using C++14 compiler
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sk/Firmware/build/px4_sitl_default/build_gazebo
[3/6] Performing build step for 'sitl_gazebo'
ninja: no work to do.
[6/6] cd /home/sk/Firmware/build/px4_sitl_default/tmp && /home/sk/Firmware/Tools/sitl_run.sh /home/sk/Firmware/build/px4_sitl_default/bin/px4 none gazebo none /home/sk/Firmware /home/sk/Firmware/build/px4_sitl_default
SITL ARGS
sitl_bin: /home/sk/Firmware/build/px4_sitl_default/bin/px4
debugger: none
program: gazebo
model: none
src_path: /home/sk/Firmware
build_path: /home/sk/Firmware/build/px4_sitl_default
empty model, setting iris as default
GAZEBO_PLUGIN_PATH :/home/sk/Firmware/build/px4_sitl_default/build_gazebo:/home/sk/Firmware/build/px4_sitl_default/build_gazebo
GAZEBO_MODEL_PATH :/home/sk/catkin_ws/src/avoidance/sim/models:/home/sk/Firmware/Tools/sitl_gazebo/models:/home/sk/Firmware/Tools/sitl_gazebo/models
LD_LIBRARY_PATH /home/sk/catkin_ws/devel/lib:/opt/ros/kinetic/lib:/opt/ros/kinetic/lib/x86_64-linux-gnu:/home/sk/Firmware/build/px4_sitl_default/build_gazebo:/home/sk/Firmware/build/px4_sitl_default/build_gazebo
Gazebo multi-robot simulator, version 7.0.0
Copyright (C) 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 10.3.18.229
[Dbg] [gazebo_mavlink_interface.cpp:137] <joint_name> not found for channel[0] no joint control will be performed for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:137] <joint_name> not found for channel[1] no joint control will be performed for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:137] <joint_name> not found for channel[2] no joint control will be performed for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:137] <joint_name> not found for channel[3] no joint control will be performed for this channel.
[Wrn] [gazebo_mavlink_interface.cpp:126] joint [zephyr_delta_wing::propeller_joint] not found for channel[4] no joint control for this channel.
[Wrn] [gazebo_mavlink_interface.cpp:126] joint [zephyr_delta_wing::flap_left_joint] not found for channel[5] no joint control for this channel.
[Wrn] [gazebo_mavlink_interface.cpp:126] joint [zephyr_delta_wing::flap_right_joint] not found for channel[6] no joint control for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:137] <joint_name> not found for channel[7] no joint control will be performed for this channel.
[Msg] Conecting to PX4 SITL using TCP
[Msg] Lockstep is enabled
[Msg] Speed factor set to: 1
SITL COMMAND: "/home/sk/Firmware/build/px4_sitl_default/bin/px4" "/home/sk/Firmware"/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t "/home/sk/Firmware"/test_data
INFO  [px4] Creating symlink /home/sk/Firmware/ROMFS/px4fmu_common -> /home/sk/Firmware/build/px4_sitl_default/tmp/rootfs/etc
ERROR [px4_daemon] error binding socket
0 WARNING: setRealtimeSched failed (not run as root?)

______  __   __    ___ 
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

px4 starting.

INFO  [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
Error: no autostart file found (etc/init.d-posix/ERROR [px4_daemon] error connecting to socket_*)
ERROR [px4] Startup script returned with return value: 256
pxh> Gazebo multi-robot simulator, version 7.0.0
Copyright (C) 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 10.3.18.229
[Wrn] [Event.cc:87] Warning: Deleteing a connection right after creation. Make sure to save the ConnectionPtr from a Connect call

Exiting...
pxh> Shutting down
/home/sk/Firmware/Tools/sitl_run.sh: line 151: kill: (666) - No such process
ninja: build stopped: interrupted by user.
Makefile:190: recipe for target 'px4_sitl_default' failed
make: *** [px4_sitl_default] Interrupt

If I run that same command with sudo in front I have no issues. I have tried adding the user to the dialout group, however this didn’t help.

I’m not sure what I’ve managed to break. I’ve tried recloning the firmware with no success, as well as make clean too.

Any suggestions on what the issue might be would be really helpful.
Thanks!

Same issue here.

For the record I’m on Ubuntu 18.04. I was messing with some files trying to add a new model but now I’m trying on a reset master and I have the same outcome as you. Using sudo works so atleast we have that.

Hm, that’s odd. Can you check if you have permissions to /tmp?

yap by using /tmp it just moves me to that directory so yea all good

What’s the output of this?

ls -ld /tmp

drwxrwxrwt 17 root root 12288 Mar 15 13:36 /tmp

Ok, that’s the same that I have, so shouldn’t be the problem.

Can you change this line:

to:

PX4_ERR("error connecting to socket: %s", strerror(errno));

and see what the output is?

Hi, I met the same problem and I tried to let it report the problem. it showed “ERROR [px4_daemon] error connecting to socket: Permission denied”

Since it’s a permission problem, can you try if it works with sudo?

I am having the same issue. However, making the changes that @JulianOes suggest doesn’t print anything new. I found making the same changes in the following file, PX4/platforms/posix/src/px4_daemon/server.cpp does provide additional information. The error is:

ERROR [px4_daemon] error connecting to socket: Address already in use

Hope this can help.

1 Like

The path to the socket file is described in PX4/platforms/posix/src/px4_daemon/sock_protocol.cpp. In my case it was /tmp/px4-sock-*

Go to /tmp and see who owns your px4-sock file. If it is owned by root, that’s why you cannot build PX4 without sudo. Just delete both of the px4-sock* files and build PX4 without sudo.

If you built PX4 with root before some of the built files will be owned by root. You will need to delete those. In my case it was the hidden files: .ninja_deps and .ninja_log located in PX4/build/px4_sitl_default

10 Likes

@hhenryy, correct explanation of the problem. You should be a part of the dev team. Thanks it solved my problem.

This works great. Thank you very much.