-
-
Notifications
You must be signed in to change notification settings - Fork 512
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
Camera Commands Infinite loop with gazebo sitl with typhoon model #2431
Comments
I believe this is correct. At least I know that https://github.com/JonasVautherin/px4-gazebo-headless does not have a camera implementation 👍. |
Ah, then I know why it does not work. But why does the server go into an infinite loop? Does this line mean something to debug this problem? Is 1/100 sysid/comp id for the supposed camera component? Command ack for 522 (from: 1/1) does not match command 522 (to: 1/100) The command should just fail right? |
Also, the typhoon_480 model used in https://github.com/JonasVautherin/px4-gazebo-headless does have a camera_manager_plugin attached to it, so why does it not work with mavsdk_server commands? |
I think so, yes.
If it was sent to 1/100, then 1/1 should not ACK it. If there is no camera server, it should time out.
I never enabled it in px4-gazebo-headless, because I don't think it existed when I wrote it and I never used the camera_manager_plugin myself. If you know how to use it and manage to enable it in px4-gazebo-headless, I would love to get a PR! |
I am not sure if I know how to adapt it. I will try to explain what I learned. Then there is a init script PX4 Init Script SITL contains the command which starts mavlink streaming for the camera module as well as gimbal. Then there is another override file i think which defines additional commands such as default params as for Typhoon 480 which defines some parameters for the gimbal (MNT_MODE_IN, MNT_MODE_OUT which both means Mavlink 2 Gimbal). I do not see any param for camera and also could not successfully find in the px4 documentation which param to set for camera. Do you have any hint? |
just checked the sdf file generated in the gazebo px4 headless docker container and the camera manager related parameters are: <plugin name="CameraManagerPlugin" filename="libgazebo_camera_manager_plugin.so">
<robotNamespace>typhoon_h480</robotNamespace>
<interval>1</interval>
<width>3840</width>
<height>2160</height>
<maximum_zoom>8.0</maximum_zoom>
<video_uri>udp://127.0.0.1:5600</video_uri>
<system_id>1</system_id>
<cam_component_id>100</cam_component_id>
<mavlink_cam_udp_port>14530</mavlink_cam_udp_port>
</plugin> so at least the
somehow makes sense since the camera component has id 100. Does the udp port needs to be modified? At least the video stream works so there has to be something wrong with mavlink configuration somewhere. There was another user with similar problem last year. |
the simulator logs throws an error related to exiftool and then proceeds to log the following: INFO [dataman] data manager file './dataman' size is 7872608 bytes
INFO [init] PX4_SIM_HOSTNAME: localhost
INFO [simulator_mavlink] Waiting for simulator to accept connection on TCP port 4560
INFO [simulator_mavlink] Simulator connected on TCP port 4560.
INFO [lockstep_scheduler] setting initial absolute time to 340000 us
WARN [vehicle_angular_velocity] no gyro selected, using sensor_gyro_fifo:0 1310988
INFO [commander] LED: open /dev/led0 failed (22)
ERROR [param] Parameter UXRCE_DDS_DOM_ID not found.
etc/init.d-posix/rcS: 310: etc/init.d-posix/rcS: uxrce_dds_client: not found
INFO [mavlink] mode: Normal, data rate: 4000000 B/s on udp port 18570 remote port 14550
INFO [mavlink] mode: Onboard, data rate: 4000000 B/s on udp port 14580 remote port 14540
INFO [mavlink] mode: Onboard, data rate: 4000 B/s on udp port 14280 remote port 14030
INFO [mavlink] mode: Gimbal, data rate: 400000 B/s on udp port 13030 remote port 13280
INFO [mavlink] mode: Onboard, data rate: 4000 B/s on udp port 14558 remote port 14530
INFO [logger] logger started (mode=all)
INFO [logger] Start file log (type: full)
INFO [logger] [logger] ./log/2024-10-23/16_14_49.ulg
INFO [logger] Opened full log file: ./log/2024-10-23/16_14_49.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 [mavlink] partner IP: 127.0.0.1
INFO [tone_alarm] home set
INFO [commander] Ready for takeoff! says nothing about camera. probably failing to load the camera driver because exiftool not found? |
aha, just found this error message in the camera plugin: if (system("exiftool -ver &>/dev/null") != 0) {
gzerr << "exiftool not found. geotagging_images plugin will be disabled" << endl;
gzerr << "On Ubuntu, use 'sudo apt-get install libimage-exiftool-perl' to install" << endl;
return;
} will install it and try it again. |
nope, the warning goes away but still the same issue of infinite loop. |
the logs from the mavsdk_server are: [06:39:25|Debug] MAVLink: critical: Preflight Fail: High Gyro Bias (system_impl.cpp:243)
[06:39:25|Error] notify_current_settings has no camera definition (camera_impl.cpp:2149)
[06:39:25|Error] notify_possible_setting_options has no camera definition (camera_impl.cpp:2192)
[06:39:25|Debug] COMMAND_LONG 522 to send to 1, 100 (mavlink_command_sender.cpp:112)
[06:39:25|Debug] Sent command 522 (mavlink_command_sender.cpp:407)
[06:39:25|Debug] Command ack for 522 (from: 1/1) does not match command 522 (to: 1/100) after 0.00392617 s (mavlink_command_sender.cpp:172)
[06:39:25|Debug] Received ack from 1/1 for not-existing command: 522! Ignoring... (mavlink_command_sender.cpp:283)
[06:39:26|Debug] Got timeout! (mavlink_command_sender.cpp:296)
[06:39:26|Warn ] sending again after 0.508501 s, retries to do: 3 (522). (mavlink_command_sender.cpp:320) Do the following error related to the camera have anything to do the issue: [06:39:25|Error] notify_current_settings has no camera definition (camera_impl.cpp:2149)
[06:39:25|Error] notify_possible_setting_options has no camera definition (camera_impl.cpp:2192) and from the camera.py example from Mavsdk-python are: Waiting for drone to connect...
-- Connected to drone!
Setting mode to 'PHOTO'
Camera mode: UNKNOWN
Setting mode failed with error code: TIMEOUT
Taking a photo
Couldn't take photo: TIMEOUT |
I think that the So I assume you are testing all this with px4-gazebo-headless? Is the camera_manager_plugin enabled (or did you manage to enable it)? Then the question would be: where does it send MAVLink (like is it multiplexed with the autopilot stream?)? |
yes i am testing with px4-gazebo-headless. If the camera_manager_plugin only needs to be enabled in the model sdf file then seems to be enabled. regarding where does the plugin send mavlink, that should be in the sdf file right? <plugin name="CameraManagerPlugin" filename="libgazebo_camera_manager_plugin.so">
<robotNamespace>typhoon_h480</robotNamespace>
<interval>1</interval>
<width>3840</width>
<height>2160</height>
<maximum_zoom>8.0</maximum_zoom>
<video_uri>udp://127.0.0.1:5600</video_uri>
<system_id>1</system_id>
<cam_component_id>100</cam_component_id>
<mavlink_cam_udp_port>14530</mavlink_cam_udp_port>
</plugin> mavlink_cam_udp_port is 14530. Now in the init script for px4 sitl i see this line referring to the camera in the commented out line but the mavlink stream start commands refers to onboard module. Does this mean that this is completely missing the camera module in the init script or wrong remote port? |
Right, so px4-gazebo-headless changes this px4-rc.mavlink file (here) in order to redirect some of the mavlink streams to the docker host on ports 14540 (for MAVSDK) and 14550 (for QGC). It seems like the camera plugin sends to 14530. It probably stays inside the container. But for MAVSDK's purpose, we would rather have both PX4 and the camera plugin send on the same stream (from the same port, to the same port). Is there a way to configure it such that the camera plugin sends MAVLink to PX4 and PX4 forwards it to its other ports? I think some kind of forwarding existed, maybe it could be used here 🤔. @julianoes: would that be a valid use for PX4 forwarding? |
can it not be made to work like gimbal_plugin? is there a diference in how a camera manager interacts with px4 vs gimbal_manager <-> px4? |
How is the gimbal plugin working there? It would be interesting to know the difference with the camera plugin indeed 👍 |
Without having read everything, yes that might help. |
Hi,
I am trying to run the camera+gimbal with the gazebo sitl (px4 1.15.0) with mavsdk-python (mavsdk 2.12.11). When I run the camera.py example while manually running the mavsdk_server, I get the following logs from mavsdk_server. On the Mavsdk-python side i get timeout messages. The gimbal.py example runs fine without any problem.
Does this mean that the SITL with Typhoon model does not have camera server side implementation? Or am i missing something. I would like to test as much camera plugin with sitl mode as possible. Are there any alternatives for this? Thanks!
The text was updated successfully, but these errors were encountered: