Gimbal detects as a FC or FC detects as a gimbal in console and Getting parameters 26 endlessly. Plugin MP

Hello,
I’m using a orange cube with a gimbal home made. The goal of my plugin is to communicate in a certain way with the gimbal.
I’m testing my new plugin and i have these in the mission planner console :

INFO MissionPlanner.MAVLinkInterface - ID sys 100 comp 2 ver3 type GIMBAL name INVALID
INFO MissionPlanner.MAVLinkInterface - set giveComport current True new False
INFO MissionPlanner.MAVLinkInterface - Get Param whole list retry 0 got 0 75%=0 count 1
INFO MissionPlanner.MAVLinkInterface - set giveComport plugin runner thread current False new True
bps 1824 loss 0 left 0 mem 112,4619140625 mav2 True sign False mav1 1 mav2 59 signed 0

And when i connect my plugin with my gimbal via MP, there is no problem but only if i connect firstly my orange cube to MP and then i execute my gimbal code. However if i execute firstly my gimbal code (with request for RC Channels for FC, heartbeat for GCS and FC…) and then i connect my orange cube, there is a problem.
I have the loading Getting parameters 100 being there endlessly. And when i click on cancel, i can’t get my RC channels values.

My gimbal is sysid 100 and compid 2.
I’m sending with my gimbal heartbeat to the GCS and FC and a command long with MAV_CMD_SET_MESSAGE_INTERVAL inside to ask for RC_CHANNELS to the FC.

I’m sorry i can’t give you the source code because i’m doing an internship so i would like to not show the code. Very sorry for that.

[EDIT] When it works, i have these logs :
INFO MissionPlanner.MAVLinkInterface - ID sys 100 comp 2 ver3 type QUADROTOR name ARDUPILOTMEGA
INFO MissionPlanner.MAVLinkInterface - set giveComport current True new False

and when it doesn’t work, i have these logs :
INFO MissionPlanner.MAVLinkInterface - ID sys 100 comp 2 ver3 type GIMBAL name INVALID
INFO MissionPlanner.MAVLinkInterface - ID sys 1 comp 1 ver3 type GIMBAL name INVALID

So when it works, it’s because MP considered the FC and the gimbal like FC, and when it doesn’t work it’s because it considered the FC and the gimbal like gimbals.
I don’t understand why because in my plugin i can differentiate, with the heatbeat, if it’s a gimbal or a FC like this :

       // detection of the gimbal by heartbeat and display of the form
       MAVLinkMessage mavHB = Host.comPort.getHeartBeat();

       if (mavHB.msgid == (byte)MAVLINK_MSG_ID.HEARTBEAT)
       {
           mavlink_heartbeat_t hb = mavHB.ToStructure<mavlink_heartbeat_t>();

           if (hb.type == (byte)MAV_TYPE.GIMBAL)
           {
               // if we have front = 0, mean that the option display virtual button has been choosen in the toolstrip menu
               if (front == 0)  // we do it like this to avoid problem linked to popup in background/frontground
               {
                   front = 1;
                   value_slider = slider.Value;
                   StartFormThread();
               }
               if (state == 0)
               {
                   CustomMessageBox.Show("Gimbal Heartbeat Detected ");
                   if (displayform < 2)
                   {
                       StartButtonThread();
                       StartFormThread();
                       displayform++;
                       virtualorreal = 0;
                   }
                   state = 1;
               }
               MAVLink.MAVLinkMessage mavMes = Host.comPort.readPacket();
               iStart = Environment.TickCount;
           }
           if ((Environment.TickCount - iStart > 20000) && (state == 1))
           {
               state = 0;
               displayform = 0;
               if (("" + Host.comPort).Contains("MAV 1") == true) // Mavlink still Connected
               {
                   CustomMessageBox.Show("Gimbal Heartbeat not detected anymore");
               }
           }
       }

I don’t know if it can help you but here is a screen of the mavlink inspector :
image

Help me i’m totally stuck.

Thank you for giving me idea to solve this problem.
Sincerely.

@Michael_Oborne @Eosbandi @amilcarlucas

It sounds like you have your gimbal selected in mission planner, its showing up as a separate mavlink component because it has a heartbeat. Under the connect button there is a drop down menu, you need to select your flight controller or it will try and load parameters from the other device.

Thank you for your response.
The gimbal wasn’t selected in Mission Planner, it was already the FC :
image
For the moment, i write in my plugin and my gimbal code a delay when the FC is connecting, so i don’t have problem of cross sending heartbeat. But now, my FC is considered as a FC and my gimbal is also considered as a FC.
I don’t understand how because the heartbeat message i’m sending has a type of 26 (gimbal).

I put here again the log :

INFO MissionPlanner.MAVLinkInterface - ID sys 1 comp 1 ver3 type QUADROTOR name ARDUPILOTMEGA
INFO MissionPlanner.MAVLinkInterface - set giveComport current True new False
INFO MissionPlanner.MAVLinkInterface - set giveComport plugin runner thread current False new True
INFO MissionPlanner.MAVLinkInterface - ID sys 100 comp 2 ver3 type QUADROTOR name ARDUPILOTMEGA

you have the gimbal set to

2 [MAV_TYPE_QUADROTOR] minimal.xml · MAVLink Developer Guide

100 [MAV_COMP_ID_CAMERA] 100 MAV_COMP_ID_CAMERA

I think you want

26 [MAV_TYPE_GIMBAL] MAV_TYPE_GIMBAL

154 [MAV_COMP_ID_GIMBAL] 154 MAV_COMP_ID_GIMBAL

I thought i can put random number for sysid and compid so i put 100 and 2. I already put this but only in the heartbeat!

I change this and i tell you if it’s working, thank you very much!

Thank you , i didn’t know it was important, i thought only the heartbeat was used to determine the type. In MP it detects the gimbal like a gimbal in the mavlink inspector and the window under connect button. But MP also trying to get the parameters of the gimbal, like it is a FC.
So sometimes, i get : Get params 26 endlessly when i’m connecting.

INFO MissionPlanner.MAVLinkInterface - ID sys 26 comp 154 ver3 type QUADROTOR name ARDUPILOTMEGA
INFO MissionPlanner.MAVLinkInterface - set giveComport current True new False
INFO MissionPlanner.MAVLinkInterface - set giveComport plugin runner thread current False new True
INFO MissionPlanner.MAVLinkInterface - ID sys 1 comp 1 ver3 type QUADROTOR name ARDUPILOTMEGA

image

Thank you again.

what else do you have sending messages? there should only be 2 devices.

there are only 2 devices :

  • my orange cube
  • my home made gimbal, with a code inside

And i’m coding a plugin on my MP to make communication between MP and gimbal.
(for example to send some text to my gimbal :

        Host.comPort.generatePacket(MAVLINK_MSG_ID.STATUSTEXT, new MAVLink.mavlink_statustext_t(6, textToSend, 0, 0), 26, 154, true, false);

)

can you cancel that then select your flight controller from the drop down or does it disconnect?

have you read this ?

https://www.olliw.eu/storm32bgc-wiki/MAVLink_Communication

when i cancel this, i can’t get parameters (even from the FC sysid 1).
It’s weird because MP understands that it is a gimbal, i’m also sending a gimbal type heartbeat. But in the logs, it keeps telling that it’s like my FC : - ID sys 26 comp 154 ver3 type QUADROTOR name ARDUPILOTMEGA
Is it because i’m sending message from my plugin directly to the gimbal ? I don’t know

does your heartbeat match the one from the storm32 page?

* type: MAV_TYPE_GIMBAL (= 26)
 * autopilot: MAV_AUTOPILOT_INVALID (= 8)
 * base_mode: 
     when in NORMAL mode MAV_MODE_FLAG_STABILIZE_ENABLED (= 0x10) and MAV_MODE_FLAG_SAFETY_ARMED (= 0x80) are set
 * custom_mode:
     lowest byte (0x000000FF): STATE value
     2nd & 3rd bytes (0x00FFFF00): prearm checks flags
     highest bit (0x80000000): bit is set if prearm checks are not passed
 * system_status: 
     either MAV_STATE_BOOT (= 1), MAV_STATE_STANDBY (= 3), MAV_STATE_ACTIVE (= 4) or MAV_STATE_EMERGENCY (= 6)

image

I put like this

something doesnt look right, can you show me all the components in mavlink inspector?

this is how my lidar looks

sure :

does your gimbal send back any data?

yes, my gimbal is sending heartbeat to FC and MP, and is also sending one command long with MAV_CMD_SET_MESSAGE_INTERVAL inside to the FC to get the RC channels. But all of this data is send from my code inside the gimbal.

MP is also sending message to the gimbal with my plugin, like the status text message i posted.

it shouldnt be detected as component 0. under component 154 there should be the heartbeat and the gimbal.

So it’s a problem with the orange cube and not the gimbal ? Is it from the firmware ?

its your gimbal not sending the correct information.

ah i think i understand, let me try something