Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 1441

Wrong argument type when writing quaternion orientation to pose message

$
0
0
**Edit:** I tried to just simply copy the quaternion values and hardcode them as an orientation coordinates. Results are the same, so maybe problem comes from another part of my grasp msg? I dumped the message which I'm trying to use to pick my object: [link text](https://pastebin.com/xceknYxC) ---------- Hi, I'm trying to generate `moveit_msgs/Grasp Message` using Python API and I'm getting ROSSerializationException in place where calculated quaternion values are assigned into `geometry_msgs/Pose Message/orientation`. Piece of code where I'm making Grasp message and trying to get quaternion from euler angles: p = PickPlaceInterface("arm", "gripper", verbose=True) g = Grasp() g.id = "test" gp = PoseStamped() gp.header.frame_id = "base_link" gp.pose.position.x = grasps[0].surface.x gp.pose.position.y = grasps[0].surface.y gp.pose.position.z = grasps[0].surface.z quat = quaternion_from_euler(grasps[0].approach.x, grasps[0].approach.y, grasps[0].approach.z) print ("Quat type: " + str(type(quat[0]))) print ("Pose orient type: " + str(type(gp.pose.orientation.x))) gp.pose.orientation.x = float(quat[0]) gp.pose.orientation.y = float(quat[1]) gp.pose.orientation.z = float(quat[2]) gp.pose.orientation.w = float(quat[3]) g.grasp_pose = gp g.pre_grasp_approach.direction.header.frame_id = "base_link" g.pre_grasp_approach.direction.vector.x = 1.0 g.pre_grasp_approach.direction.vector.y = 0.0 g.pre_grasp_approach.direction.vector.z = 0.0 g.pre_grasp_approach.min_distance = 0.001 g.pre_grasp_approach.desired_distance = 0.1 g.pre_grasp_posture.header.frame_id = "base_link" g.pre_grasp_posture.joint_names = ["gripper_axis"] pos = JointTrajectoryPoint() pos.positions.append(0.0) g.pre_grasp_posture.points.append(pos) g.grasp_posture.header.frame_id = "base_link" g.grasp_posture.joint_names = ["gripper_axis"] pos = JointTrajectoryPoint() pos.positions.append(0.02) pos.effort.append(0.0) g.grasp_posture.points.append(pos) g.allowed_touch_objects = [] g.max_contact_force = 0 g.grasp_quality = grasps[0].score p.pickup("obj", [g, ], support_name="supp") **grasps[0].approach** is a `geometry_msgs/Vector3` message. **grasps** is a list of GraspConfig.msg which is defined here: [link text](https://github.com/atenpas/gpd/blob/master/msg/GraspConfig.msg) I'm getting this exception: Traceback (most recent call last): File "pick_and_place.py", line 83, in err = p.pickup("obj", [g, ], support_name="supp") File "/opt/ros/kinetic/lib/python2.7/dist-packages/moveit_python/pick_place_interface.py", line 154, in pickup self._pick_action.send_goal(g) File "/opt/ros/kinetic/lib/python2.7/dist-packages/actionlib/simple_action_client.py", line 92, in send_goal self.gh = self.action_client.send_goal(goal, self._handle_transition, self._handle_feedback) File "/opt/ros/kinetic/lib/python2.7/dist-packages/actionlib/action_client.py", line 553, in send_goal return self.manager.init_goal(goal, transition_cb, feedback_cb) File "/opt/ros/kinetic/lib/python2.7/dist-packages/actionlib/action_client.py", line 466, in init_goal self.send_goal_fn(action_goal) File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 886, in publish raise ROSSerializationException(str(e)) rospy.exceptions.ROSSerializationException: : 'required argument is not a float' when writing 'x: 0.008194649141243238 y: 0.1413781390046223 z: 0.44856469150891914 w: 0.8824595101581431' Looks simple, I'm just messing with types. But when I checked them with: print ("Quat type: " + str(type(float(quat[0])))) print ("Pose orient type: " + str(type(gp.pose.orientation.x))) I'm getting: Quat type: Pose orient type: And now I'm confused ... Do you have an idea what I'm doing wrong? I tried also numpy conversions and tricks mentioned here: [link text](https://answers.ros.org/question/69754/quaternion-transformations-in-python/), but results are the same. I'm using ROS Kinetic and Ubuntu 16.04

Viewing all articles
Browse latest Browse all 1441

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>