Local orientation per joint is an empty array and Global root orientation is always [0, 0, 0, 0]

Hello, I am having issues getting the global_root_orientation and the local_orientation_per_joint. The output on the terminal for global_root_orientation is always [0. 0. 0. 0.], as for local_orientation_per_joint I always get empty arrays [] :
terminal_output

I was not able to upload the full script, so here is a snippet of the while loop :

    while viewer.is_available():


        # Grab an image
        if zed.grab() == sl.ERROR_CODE.SUCCESS:
            # Retrieve left image
            zed.retrieve_image(image, sl.VIEW.LEFT, sl.MEM.CPU, display_resolution)
            # Retrieve bodies
            zed.retrieve_bodies(bodies, body_runtime_param)

            # Update GL view
            viewer.update_view(image, bodies)

            # -----------------------------------------------------
            # ----------------------- INFOS -----------------------
            # -----------------------------------------------------

            v_key_pressed_current = keyboard.is_pressed('v')
            if  len(bodies.body_list)==1 and v_key_pressed_current and not v_key_pressed_prev:
                print(t.BRIGHT_RED,"\n----DETECTION!----\n",t.RESET)
                print (t.BRIGHT_RED,"----",time.strftime("%H:%M:%S"),t.RESET)
                for kp in bodies.body_list[0].bounding_box :
                    print(t.GREEN,"--Bounding Box:",t.RESET)
                    print(kp)

                for kp in bodies.body_list :
                    print(t.MAGENTA,"--Dimensions:",t.RESET)
                    print(kp.dimensions)

                for kp in bodies.body_list[0].velocity :
                    print(t.BLUE,"--Vel:",t.RESET)
                    print(kp)

                for kp in bodies.body_list :
                    print(t.BRIGHT_BLUE,"--CONFIDENCE:",t.RESET)
                    print(kp.confidence)

                for kp in bodies.body_list :
                    print(t.CYAN,"--Position:",t.RESET)
                    print(kp.position)

                for kp in bodies.body_list :
                    print(t.BLUE,"--Keypoint:",t.RESET)
                    print(kp.keypoint)

                for kp in bodies.body_list :
                    print(t.BRIGHT_GREEN,"--Joint orientation:",t.RESET)
                    print(kp.local_orientation_per_joint)

                print(t.YELLOW,"--Global root orientation:",t.RESET)
                print(bodies.body_list[0].global_root_orientation)
            v_key_pressed_prev = v_key_pressed_current
            # -----------------------------------------------------
            # --------------------- END INFOS ---------------------
            # -----------------------------------------------------

            # Update OCV view
            image_left_ocv = image.get_data()
            cv_viewer.render_2D(image_left_ocv,image_scale, bodies.body_list, body_param.enable_tracking, body_param.body_format)
            #cv2.imshow("ZED | 2D View", image_left_ocv)
            key = cv2.waitKey(key_wait)
            if key == 113: # for 'q' key
                print("Exiting...")
                break
            if key == 109: # for 'm' key
                if (key_wait>0):
                    print("Pause")
                    key_wait = 0 
                else : 
                    print("Restart")
                    key_wait = 10 

Any help would be appreciated, thank you in advance for your support.

Hi,
the orientations are only available when sl::BodyTrackingParameters::enable_fitting is set to true.

Here : zed-sdk/body tracking/body tracking/cpp/src/main.cpp at master · stereolabs/zed-sdk · GitHub

1 Like

Thank you very much, it was indeed the enable_body_fitting that was set to False. Problem is solved. Though for some reason, I managed to retrieve rotations using sl.BODY_FORMAT.BODY_34 instead of sl.BODY_FORMAT.BODY_38 while still having enable_body_fitting disabled.

yes, that’s because the fitting is automatically enabled with this model.
This is not very clear I have to admit that.

1 Like