seg fault with points[0] [closed]
this line gives me a seg fault: grasp_data_.pre_grasp_posture_.points[0].positions.resize(1);
is there any solution for this?
it is being caused by points[0]. i know this because it happened another time when i was trying to convert manipulation_msgs::Grasp to moveit_msgs::Grasp.
here is the struct of grasp_data_ as used by dave coleman's clam arm:
namespace block_grasp_generator
{
struct RobotGraspData
{
RobotGraspData() :
// Fill in default values where possible:
base_link_("/base_link"),
grasp_depth_(0.12),
angle_resolution_(16),
approach_retreat_desired_dist_(0.6),
approach_retreat_min_dist_(0.4),
block_size_(0.04)
{}
//sensor_msgs::JointState pre_grasp_posture_;
//sensor_msgs::JointState grasp_posture_;
trajectory_msgs::JointTrajectory pre_grasp_posture_;
trajectory_msgs::JointTrajectory grasp_posture_;
std::string base_link_; // name of global frame with z pointing up
std::string ee_parent_link_; // the last link in the kinematic chain before the end effector, e.g. "/gripper_roll_link"
double grasp_depth_; // distance from center point of object to end effector
int angle_resolution_; // generate grasps at PI/angle_resolution increments
double approach_retreat_desired_dist_; // how far back from the grasp position the pregrasp phase should be
double approach_retreat_min_dist_; // how far back from the grasp position the pregrasp phase should be at minimum
double block_size_; // for visualization
};
block_grasp_generator::RobotGraspData grasp_data_;
i have to use moveit_msgs::Grasp because pick place needs it in hydro as opposed to groovy which uses manipulation_msgs(moveit/move_group_interface/move_group.h), therefore i have changed sensor_msgs to trajectory_msgs.
i am using:
ros hydro
kubuntu 12.04 precise
Must be something to do with the memory resource management.
If you compile in debug and use GDB, you will be able to see what's in your memory when it crashes. This should tell you what you did wrong.