MAVSDK gimbal pitch and yaw

I want to read the gimbal pitch and yaw using a companion computer from the plan that is already loaded to px4 using QGC.
I am using get_gimabl_pitch_deg() and get_gimbal_yaw_deg() but i am getting a NaN.
How to read gimbal pitch and yaw using MAVSDK?

Tried void mavsdk::Telemetry::camera_attitude_euler_angle_async(attitude_euler_angle_callback_t callback)but no data.

Right, it might not be sent by the Autopilot (or gimbal). What is the gimbal that you’re using and what’s your settings for vmount to make it work?

I am using a custom camera with Gimbal. The gimbal and camera are not connected to the AutoPilot. They are connected to the companion computer. I just want to the read the gimbal pitch and yaw from the plan that is being set using QGC and then uploaded into the pixhawk. QGC will make a plan with some settings of Gimbal pitch and yaw and then upload to PX4. I just want to read this gimbal pitch and yaw using companion computer and then control the Gimbal which is connected to companion computer.

And MAVSDK is connected to the companion computer and not the autopilot then? And does the gimbal support sending the MAVLink message MOUNT_ORIENTATION?

Without more detail it’s hard to help here.

Yes MAVSDK is running on companion computer. And gimbal does not support mavlink. Its an ip camera gimbal which i can control from the user made application running on companion computer. I just want to read the gimbal pitch and yaw which the user set in the QGC plan so that i can move my camera accordingly from application running in companion computer.

Neither the Gimbal nor the camera support mavlink. Camera with gimbal is connected to companion computer. MAVSDK is running on companion computer and a MAVLINK uart is connected between PX4 and companion computer.
So the scheme is user will make a structure scan plan using QGC and upload it into PX4. MAVSDK running on companion computer and will start the plan and read camera angles from the plan file and set camera orientation accordingly. But the problem is i cannot read camera angles.

So the autopilot does not set the camera angles? Because if it did it could also send out the MOUNT_ORIENTATION and that way solve your problem of knowing the angle.

the camera is not controlled by autopilot there is no link between camera and autopilot. Camera is only connected to the companion computer.
.When we make a plan in QGC and upload it to the autopilot. It is uploaded to the autopilot as a json file and in that file there are all the waypoints that autopilot reads and execute them. But there is also camera angle information in that file.And as autopilot read all this information from jason file so it should have that camera information too. How can i send this camera information to the companion computer.?

I am new to PX4 and QGC maybe i am wrong in somethings or missing some step.
My target is to set the camera automatically during a mission. User will make a mission in QGC and upload it the PX4(autopilot) and when user will make a structure plan in QGC there is an option to set the gimbal pitch and yaw. I just want this information to reach companion computer. Is there any mavlink message in mavsdk that can do this.
As camera gimbal does not have mavlink so when this information will reach companion computer i can write my own code to set the gimbal.

Generally the autopilot (so PX4) would communicate the needed camera angle to a gimbal (in your case the companion computer). So you need to configure PX4 to send out MAVLink commands for your gimbal using MNT_MODE_OUT set to MAVLink. You could then parse these commands either using MAVSDK using the passthrough plugin or using some MAVLink library.

okay thanks thats what i was looking for. But there is no mavlink_passthrough plugin in my user directory. I tried to build battery example too but mavlink_passthrough.h no such file or directory. I tried make ENABLE_MAVLINK_PASSTHROUGH=1 no suceess error is same.

You need to rebuild from the beginning for the passthrough plugin. So easiest is to delete the build directory and start new.

Instructions are here:
https://mavsdk.mavlink.io/develop/en/contributing/build.html

I set the MNT_MODE_IN to auto and MNT_MODE_OUT to mavlink. Set up my gazebo hitl environment. uploaded the Plan and then subscribe to MOUNT_ORIENTATION through the mavlink passthrough plugin. But still no gimbal orientation from autopilot.