SITL GImbal Control

Hello people,

I am searching for the method for controlling the gimbal inside sitl.
I addapted gimbal from Typhoon to Solo model, but cannot understand how it is possible to control the gimbal position for following point mode (for example after getting into Offboard mode while drone is doing his mission I want to control the gimbal).

You should be able to move the gimbal using the Dronecode SDK:

The command to run the integration tests for the gimbal is:

make && build/default/integration_tests/integration_tests_runner --gtest_filter="SitlTest.Gimbal*"
1 Like

Not autostarting SITL (use AUTOSTART_SITL=1)
[02:21:36|Info ] DronecodeSDK version: 0.15.0 (dronecode_sdk_impl.cpp:25)
[02:21:36|Error] bind error: Address already in use (udp_connection.cpp:82)
…/…/integration_tests/gimbal.cpp:29: Failure
Expected equality of these values:
ret
Which is: 4-byte object <03-00 00-00>
ConnectionResult::SUCCESS
Which is: 4-byte object <00-00 00-00>
[ FAILED ] SitlTest.GimbalMove (4035 ms)
[ RUN ] SitlTest.GimbalTakeoffAndMove
Not autostarting SITL (use AUTOSTART_SITL=1)
[02:21:40|Info ] DronecodeSDK version: 0.15.0 (dronecode_sdk_impl.cpp:25)
[02:21:40|Error] bind error: Address already in use (udp_connection.cpp:82)
…/…/integration_tests/gimbal.cpp:53: Failure
Expected equality of these values:
ret
Which is: 4-byte object <03-00 00-00>
ConnectionResult::SUCCESS
Which is: 4-byte object <00-00 00-00>
[ FAILED ] SitlTest.GimbalTakeoffAndMove (4025 ms)
[ RUN ] SitlTest.GimbalROIOffboard
Not autostarting SITL (use AUTOSTART_SITL=1)
[02:21:44|Info ] DronecodeSDK version: 0.15.0 (dronecode_sdk_impl.cpp:25)
[02:21:44|Error] bind error: Address already in use (udp_connection.cpp:82)
…/…/integration_tests/gimbal.cpp:92: Failure
Expected equality of these values:
ret
Which is: 4-byte object <03-00 00-00>
ConnectionResult::SUCCESS
Which is: 4-byte object <00-00 00-00>
[ FAILED ] SitlTest.GimbalROIOffboard (4023 ms)
[----------] 3 tests from SitlTest (12083 ms total)

[----------] Global test environment tear-down
[==========] 3 tests from 1 test case ran. (12083 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 3 tests, listed below:
[ FAILED ] SitlTest.GimbalMove
[ FAILED ] SitlTest.GimbalTakeoffAndMove
[ FAILED ] SitlTest.GimbalROIOffboard

3 FAILED TESTS

:confused: Gonna try to find what causes errors

Something is already on the 14540 port. Any chance you have already MAVROS connected?

Yes, I run “roslaunch px4 mavros_posix_sitl.launch”, I will look how it will work in other way and will will answer with result, I hope it will solve the problem. Thanks for fast answer :smile:

I did it with my solo, I get errors

[02:49:57|Error] Retrying failed (205) (mavlink_commands.cpp:235)
…/…/integration_tests/gimbal.cpp:182: Failure
Expected equality of these values:
result
Which is: 4-byte object <02-00 00-00>
Gimbal::Result::SUCCESS
Which is: 4-byte object <00-00 00-00>

But If I run Typhoon_h480 everything works great, should I search for mistake in sdf file of my model or it is somewhere else?

Ok I solved it, problem was that after creating copy of gimbal i changed channels for gimbal control. Now it works (they had to be the same as for typhoon channel 6,7,8).
But for some reasons it is not doing the same staff. Only holds horrizont, not like typhoons one which inside test where following circle trajectories.

Not sure. Can you push a branch so I can have a look at the changes?

I found issue, the mixer for typhoon_h480 (leg mixer) contains gimbal mixer also in the order RPY, but mount.aux.mix has PRY. So I had actually to attach right mixer (created new one) and now it works the same as for typhoon_h480, makes a few ROI tests.

One more question, I have this error all the time:
[Err] [Plugin.hh:187] Failed to load plugin libgazebo_ros_camera.so: libCameraPlugin.so: cannot open shared object file: No such file or directory

Great, glad you figured it out!

I think that happens if the camera plugin is not built. You would have to dig into the cmake magic and check why it doesn’t get built. I’m suspecting that gstreamer dependencies are not found and therefore the plugin isn’t compiled.

1 Like