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

Not a complete answer, as your code has several problems.

Here is one: When new messages are received, msg is the variable name for the message that is passed in.

So:

rev_scan.msg.ranges[0:72]

should be

msg.ranges[0:72]

Also, note that you have not initialized req_range but rev_scan instead.

sensor_msgs/LaserScan Message is a somewhat complicated message type, I recommend that you start by trying to republish a simpler message type like std_msgs/String and then move on to more complicated types.

This is a good place to start:

http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28python%29

Not a complete answer, as your code has several problems.

Here is one: When new messages are received, msg is the variable name for the message that is passed in.

So:

rev_scan.msg.ranges[0:72]

should be

msg.ranges[0:72]

Also, note that you have not initialized the message req_rangereq_scan which you are publishing but you initialized rev_scan instead.instead, and also you are assigning the ranges to a different variable namely req_range.

sensor_msgs/LaserScan Message is a somewhat complicated message type, I recommend that you start by trying to republish a simpler message type like std_msgs/String and then move on to more complicated types.

This is a good place to start:

http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28python%29