{"action":"created","issue":{"url":"https://api.github.com/repos/mavlink/mavros/issues/767","repository_url":"https://api.github.com/repos/mavlink/mavros","labels_url":"https://api.github.com/repos/mavlink/mavros/issues/767/labels{/name}","comments_url":"https://api.github.com/repos/mavlink/mavros/issues/767/comments","events_url":"https://api.github.com/repos/mavlink/mavros/issues/767/events","html_url":"https://github.com/mavlink/mavros/issues/767","id":248979872,"number":767,"title":"Problem with Optitrack + px4 ? ","user":{"login":"EdXian","id":28064159,"avatar_url":"https://avatars0.githubusercontent.com/u/28064159?v=4","gravatar_id":"","url":"https://api.github.com/users/EdXian","html_url":"https://github.com/EdXian","followers_url":"https://api.github.com/users/EdXian/followers","following_url":"https://api.github.com/users/EdXian/following{/other_user}","gists_url":"https://api.github.com/users/EdXian/gists{/gist_id}","starred_url":"https://api.github.com/users/EdXian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EdXian/subscriptions","organizations_url":"https://api.github.com/users/EdXian/orgs","repos_url":"https://api.github.com/users/EdXian/repos","events_url":"https://api.github.com/users/EdXian/events{/privacy}","received_events_url":"https://api.github.com/users/EdXian/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-08-09T10:03:40Z","updated_at":"2017-08-09T15:33:48Z","closed_at":null,"body":"### Issue details\r\n\r\nBefore ran the offboard program , i had set my px4  parameter as following website \r\nhttps://dev.px4.io/en/ros/external_position_estimation.html \r\n\r\nFirst , I published  data vrpn_rigidbody_pose( drone's position)  to topic \"/mavros/mocap/pose\" .  \r\n\r\nSecond, I checked  data form  /mavros/mocap/pose , it's consistent with data from local_position_pose in GCS mavlink inspector or  rostopic \"local_position/pose\" . \r\n\r\nNow i try to run offboard program to set my drone at the desired point x,y,z = 0,0,0.3(as the following offb program) , but it seems the drone cant hold and out of control.  \r\n\r\n### Autopilot type and version\r\nPX4 : px4fmu-v2_lpe\r\nFirmware Version: 1.6.5\r\n\r\n### px4 parameter setting\r\n*LPE_FUSION :  12\r\n*ATT_EXT_HDG_M : 2 (for mocap)\r\n*Unchecked fuse barometer\r\n*LPE_VIC_P  : 0.0001 (default : 0.001)\r\n*LPE_PN_V : 0.2 (default:0.1)\r\n*SYS_COMPANION : 921600\r\n\r\n### Companion computer\r\nraspberry pi 2\r\nROS: Kinetic \r\nUbuntu: 16.04\r\nttyACM0 : 921600\r\n\r\n### A part of offboard code\r\n    ros::Subscriber state_sub = nh.subscribe<mavros_msgs::State>\r\n                                (\"mavros/state\", 10, state_cb);\r\n    ros::Publisher local_pos_pub = nh.advertise<geometry_msgs::PoseStamped>\r\n                                   (\"mavros/setpoint_position/local\", 10);\r\n    ros::Publisher mocap_pos_pub = nh.advertise<geometry_msgs::PoseStamped>\r\n                                   (\"mavros/mocap/pose\", 10);\r\n    ros::ServiceClient arming_client = nh.serviceClient<mavros_msgs::CommandBool>\r\n                                       (\"mavros/cmd/arming\");\r\n    ros::ServiceClient set_mode_client = nh.serviceClient<mavros_msgs::SetMode>\r\n                                         (\"mavros/set_mode\");\r\n    ros::Subscriber host_sub = nh.subscribe<geometry_msgs::PoseStamped>(\"/vrpn_client_node/RigidBody1/pose\", 1000, host_pos);\r\n    // The setpoint publishing rate MUST be faster than 2Hz.\r\n    ros::Rate rate(20.0);\r\n\r\n    // Wait for FCU connection.\r\n    while (ros::ok() && current_state.connected) {\r\n        ros::spinOnce();\r\n        rate.sleep();\r\n    }\r\n\r\n    \r\n    geometry_msgs::PoseStamped pose;\r\n\r\n\r\n    pose.pose.position.x = 0;            //the desired position\r\n    pose.pose.position.y = 0;\r\n    pose.pose.position.z = 0.3;          \r\n    pose.pose.orientation.w = 1;\r\n\r\n    mavros_msgs::SetMode offb_set_mode;\r\n    offb_set_mode.request.custom_mode = \"OFFBOARD\";\r\n\r\n    mavros_msgs::CommandBool arm_cmd;\r\n    arm_cmd.request.value = true;\r\n\r\n    ros::Time last_request(0);\r\n\r\n    while (ros::ok()) {\r\n        if (current_state.mode != \"OFFBOARD\" &&\r\n                (ros::Time::now() - last_request > ros::Duration(5.0))) {\r\n            if( set_mode_client.call(offb_set_mode) &&\r\n                    offb_set_mode.response.success) {\r\n                ROS_INFO(\"Offboard enabled\");\r\n            }\r\n            last_request = ros::Time::now();\r\n        } else {\r\n\r\n            if (!current_state.armed &&\r\n                    (ros::Time::now() - last_request > ros::Duration(5.0))) {\r\n                if( arming_client.call(arm_cmd) &&\r\n                        arm_cmd.response.success) {\r\n                    ROS_INFO(\"Vehicle armed\");\r\n                }\r\n                last_request = ros::Time::now();\r\n            }\r\n        }\r\n\r\n \r\n\tROS_INFO(\"setpoint: %.f, %.1f, %.1f\", host_mocap.pose.position.x, host_mocap.pose.position.y, host_mocap.pose.position.z);\r\n        mocap_pos_pub.publish(host_mocap);\r\n        local_pos_pub.publish(pose);\r\n\r\n        ros::spinOnce();\r\n        rate.sleep();\r\n    }\r\n    return 0;\r\n    }\r\n\r\nDoes the problem have something to do with the take_off_speed of px4 ?\r\nhttps://github.com/mavlink/mavros/issues/610\r\n\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mavlink/mavros/issues/comments/321292329","html_url":"https://github.com/mavlink/mavros/issues/767#issuecomment-321292329","issue_url":"https://api.github.com/repos/mavlink/mavros/issues/767","id":321292329,"user":{"login":"TSC21","id":5048656,"avatar_url":"https://avatars1.githubusercontent.com/u/5048656?v=4","gravatar_id":"","url":"https://api.github.com/users/TSC21","html_url":"https://github.com/TSC21","followers_url":"https://api.github.com/users/TSC21/followers","following_url":"https://api.github.com/users/TSC21/following{/other_user}","gists_url":"https://api.github.com/users/TSC21/gists{/gist_id}","starred_url":"https://api.github.com/users/TSC21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TSC21/subscriptions","organizations_url":"https://api.github.com/users/TSC21/orgs","repos_url":"https://api.github.com/users/TSC21/repos","events_url":"https://api.github.com/users/TSC21/events{/privacy}","received_events_url":"https://api.github.com/users/TSC21/received_events","type":"User","site_admin":false},"created_at":"2017-08-09T15:33:48Z","updated_at":"2017-08-09T15:33:48Z","body":"`pose.pose.orientation.w = 1;` also I advise to send the whole quaternion instead."}}
{"actor":{"display_login":"TSC21"}}