/mavros/setpoint_raw/target_local has no member named 'position'

#1

Hi , I have problem … help me please

I want to control position and yaw . so I use offboard code below

but there is catkin build problem that /mavros/setpoint_raw/target_local has no member named ‘position’ and ‘yaw’.

I can’t understand error… how can I fix it???

//CODE//

#include <ros/ros.h>
#include <std_msgs/String.h>
#include <stdio.h>
#include “geometry_msgs/PoseStamped.h”
#include “geometry_msgs/Vector3Stamped.h”

int main(int argc, char **argv)
{
ros::init(argc, argv, “pub_setpoints”);
ros::NodeHandle n;

ros::Publisher chatter_pub = n.advertise<geometry_msgs::PoseStamped>("/mavros/setpoint_raw/local",100);
ros::Rate loop_rate(100);
ros::spinOnce();

geometry_msgs::PoseStamped msg;
int count = 1;

	//PositionReciever qp;:
	//Body some_object;
	//qp.connect_to_server();

while(ros::ok()){
//some_object = qp.getStatus();
// some_object.print();
//printf("%f\n",some_object.position_x);
msg.header.stamp = ros::Time::now();
msg.header.seq=count;
msg.header.frame_id = 1;
msg.position.x = 0.0;//0.001some_object.position_x;
msg.position.y = 0.0;//0.001
some_object.position_y;
msg.position.z = 1.0;//0.001*some_object.position_z;
msg.yaw = 0;

   chatter_pub.publish(msg);
   ros::spinOnce();
   count++;
   loop_rate.sleep();

}

return 0;
}

//ERROR//

Errors << modudculab_ros:make /home/woo/catkin_ws/logs/modudculab_ros/build.make.013.log
/home/woo/catkin_ws/src/modudculab_ros/src/pub_setpoints_pos.cpp: In function ‘int main(int, char**)’:
/home/woo/catkin_ws/src/modudculab_ros/src/pub_setpoints_pos.cpp:31:12: error: ‘geometry_msgs::PoseStamped {aka struct geometry_msgs::PoseStamped_<std::allocator >}’ has no member named ‘position’
msg.position.x = 0.0;//0.001some_object.position_x;
^
/home/woo/catkin_ws/src/modudculab_ros/src/pub_setpoints_pos.cpp:32:12: error: ‘geometry_msgs::PoseStamped {aka struct geometry_msgs::PoseStamped_<std::allocator >}’ has no member named ‘position’
msg.position.y = 0.0;//0.001
some_object.position_y;
^
/home/woo/catkin_ws/src/modudculab_ros/src/pub_setpoints_pos.cpp:33:12: error: ‘geometry_msgs::PoseStamped {aka struct geometry_msgs::PoseStamped_<std::allocator >}’ has no member named ‘position’
msg.position.z = 1.0;//0.001*some_object.position_z;
^
/home/woo/catkin_ws/src/modudculab_ros/src/pub_setpoints_pos.cpp:34:12: error: ‘geometry_msgs::PoseStamped {aka struct geometry_msgs::PoseStamped_<std::allocator >}’ has no member named ‘yaw’
msg.yaw = 0;
^

#2

/mavros/setpoint_raw/local , /mavros/setpoint_raw/target_local both have same error

#3

You need to use setpoint_raw/local to control the vehicle. target_local is published by mavros to show where the setpoint is.

Both msgs are posestamped messages and do not have a member called yaw. You can look at the msg definitions at http://docs.ros.org/lunar/api/geometry_msgs/html/msg/PoseStamped.html

#4

then, how can I fix it???

can you advise me ??