ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Thank you dornhege, but i got another problem here.

This is part of my code for the function "call_execute_cartesian_ik_trajectory"

  bool call_execute_cartesian_ik_trajectory(std::string frame,  double position[6] , double     orientations[8]){
ros::service::waitForService("execute_cartesian_ik_trajectory");
ros::NodeHandle n_;
int i;

ROS_INFO("HERE %f",position[0]);

ros::ServiceClient client=n_.serviceClient<supercontroller_keyboard::ExecuteCartesianIKTrajectory>("execute_cartesian_ik_trajectory");

supercontroller_keyboard::ExecuteCartesianIKTrajectory srv;

srv.request.header.frame_id = frame;
srv.request.header.stamp = ros::Time::now();
srv.request.poses[0].position.x = position[0];

ROS_INFO("the pose[0].position.x is %f",srv.request.poses[0].position.x);

It showed an error when I run it in gdb:

Program received signal SIGSEGV, Segmentation fault.
0x000000000040510c in call_execute_cartesian_ik_trajectory (
frame=<value optimized out>, position=<value optimized out>, 
orientations=<value optimized out>)
at /home/vincent/pr2_newcontroller/supercontroller_keyboard/src/listenertest.cpp:28
28    srv.request.poses[0].position.x = position[0];

ROS_INFO("HERE %f",position[0]); shows that

[ INFO] [1312677933.412527406, 90093.731000000]: HERE 0.760000

There seems to be something wrong when i try to assign a value to srv.request.poses[0].position.x,

but message is defined as:

srv/ExecuteCartesianIKTrajectory.srv:

 Header header
 geometry_msgs/Pose[] poses
 ---
 uint32 success

Do you have any idea where went wrong?

Thank you dornhege, but i got another problem here.

This is part of my code for the function "call_execute_cartesian_ik_trajectory"

  bool call_execute_cartesian_ik_trajectory(std::string frame,  double position[6] , double     orientations[8]){
ros::service::waitForService("execute_cartesian_ik_trajectory");
ros::NodeHandle n_;
int i;

ROS_INFO("HERE %f",position[0]);

ros::ServiceClient client=n_.serviceClient<supercontroller_keyboard::ExecuteCartesianIKTrajectory>("execute_cartesian_ik_trajectory");

supercontroller_keyboard::ExecuteCartesianIKTrajectory srv;

srv.request.header.frame_id = frame;
srv.request.header.stamp = ros::Time::now();
srv.request.poses[0].position.x = position[0];

ROS_INFO("the pose[0].position.x is %f",srv.request.poses[0].position.x);

It showed an error when I run it in gdb:

Program received signal SIGSEGV, Segmentation fault.
0x000000000040510c in call_execute_cartesian_ik_trajectory (
frame=<value optimized out>, position=<value optimized out>, 
orientations=<value optimized out>)
at /home/vincent/pr2_newcontroller/supercontroller_keyboard/src/listenertest.cpp:28
28    srv.request.poses[0].position.x = position[0];

ROS_INFO("HERE %f",position[0]); shows that

[ INFO] [1312677933.412527406, 90093.731000000]: HERE 0.760000

There seems to be something wrong when i try to assign a value to srv.request.poses[0].position.x,

but the message is defined as:

srv/ExecuteCartesianIKTrajectory.srv:

 Header header
 geometry_msgs/Pose[] poses
 ---
 uint32 success

Do you have any idea where went wrong?

BTW, the service program works fine here.