Rosanswers logo

Hi guys.

I'm trying to convert point to pose. But i don't know how to do. I saw topic_tool package, but the only example is about stg_msgs. I can't find parameteres that i need. :(
And i also saw 'covert pose to point' (https://answers.ros.org/question/249104/convert-geometry_-msgspose-to-point/) The answer is so simple. But it's not for me.

Thanks you for your interest, Ray.

(edit) Code

rosrun topic_tools transform /clicked_point /clicked_pose geometry_msgs/PoseStamped \

'geometry_msgs.msg.PoseStamped( \

header=m.header,  \
pose=geometry_msgs.msg.Pose( \
  position=m.position, \
  orientation=geometry_msgs.msg.Quaternion( \
orientation.x = 0.0 \
    orientation.y = 0.0 \
orientation.z = 0.0 \
orientation.w = 0.0 \
)))' \

--import geometry_msgs


[ERROR] [1597812518.884135, 258.643000]: bad callback: <bound method TopicOp.callback of <main.TopicOp instance at 0x7fac8a25ef38>> Traceback (most recent call last): File "/home/raptor/nav_ws/src/ros_comm/clients/rospy/src/rospy/topics.py", line 750, in _invoke_callback cb(msg) File "/home/raptor/nav_ws/src/ros_comm/tools/topic_tools/scripts/transform", line 94, in callback res = eval("{}".format(self.expression), self.modules, {'m': m}) File "", line 7 orientation.y = 0.0
^ SyntaxError: invalid syntax

Originally posted by Ray_Shim on ROS Answers with karma: 27 on 2020-08-17

Post score: 0


1 Answer 1


Rosanswers logo

You can use transform from topic_tools. It is quite useful yet handy tool for which you have to care about. You can see the details of paramters here. Here is an example to use in launch file:

<?xml version="1.0"?>
  <node name="diagnostics_stamped" pkg="topic_tools" type="transform"
    args="/diagnostics /diagnostics_stamped diagnostic_msgs/DiagnosticArray 
    stamp=rospy.Time.now(), frame_id=m.name),
    level=m.level, name=m.name, message=m.message, hardware_id=m.hardware_id, values=[])])' 
    --import diagnostic_msgs std_msgs rospy"/>

To run an from terminal an example can be seen here

Originally posted by Tahir M. with karma: 213 on 2020-08-17

This answer was ACCEPTED on the original site

Post score: 0

Original comments

Comment by Ray_Shim on 2020-08-18:
Thanks for your help. But i'm still stuck.

I face problem that i don't know how to write orientation part. I cannot find any reference about orientation. I want to put all 0.0 values in orientation. So I made some simplse code. But i got error msg about syntax.

Could i get some advice about my code? (i upload my code)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.