Robotics StackExchange | Archived questions

Visualize collada file on rviz

I exported a collada file through sketch up but am unable to figure out what the problem is. Here is my code! Status on Rviz is okay but cannot see any display! Please help

#!/usr/bin/env python
import rospy
from visualization_msgs.msg import Marker

marker = Marker()
marker.header.frame_id = "/surface"
marker.header.stamp = rospy.Time()
marker.ns = "primitive_surfaces"
marker.id = 0
marker.type = marker.MESH_RESOURCE
marker.action = marker.ADD
marker.pose.position.x = 0
marker.pose.position.y = 0
marker.pose.position.z = 0
marker.pose.orientation.x = 0.0
marker.pose.orientation.y = 0.0
marker.pose.orientation.z = 0.0
marker.pose.orientation.w = 1.0
marker.scale.x = 1
marker.scale.y = 1
marker.scale.z = 1
marker.color.a = 1.0
marker.color.r = 0.0
marker.color.g = 1.0
marker.color.b = 0.0
marker.mesh_resource = "file:///home/swethmandava/catkin_ws/src/planning_inspection/planning_inspection_ros/nodes
/cuboid.dae";
pub = rospy.Publisher('surface', Marker, queue_size=1)
rospy.init_node('vis_surface')
rate = rospy.Rate(60)
while not rospy.is_shutdown():
  pub.publish(marker)
  rate.sleep()

Edit: Included rviz screenshot and frame information

image description

this is my tf frame:

#!/usr/bin/env python 
import roslib
roslib.load_manifest('planning_inspection_ros')
import rospy
import tf
if __name__ == '__main__':
    rospy.init_node('tf_broadcaster')
    br = tf.TransformBroadcaster()
    rate = rospy.Rate(10)
    while not rospy.is_shutdown():
        br.sendTransform((0.0,0.0,0.0), (0.0,0.0,0.0,1.0), rospy.Time.now(),"map", "surface")
        rate.sleep()

Asked by swethmandava on 2016-03-07 01:16:14 UTC

Comments

Answers

Your marker type is set to SPHERE. You should probably set it to MESH_RESOURCE.

Asked by ahendrix on 2016-03-07 02:30:30 UTC

Comments

Also: make sure you have the scaling right: RViz (ROS) uses meters, not millimeters.

Asked by gvdhoorn on 2016-03-07 02:50:42 UTC

@ahendrix I made the change, sorry I was trying everything. Originally it was mesh_resource but it doesn't seem to work either. @gvdhoorn yes ofcourse

Asked by swethmandava on 2016-03-07 03:23:16 UTC

I see two other potential issues here: (1) your publisher only publishes once, at startup. Subscribers may not be connected yet, and (2): do you have the correct fixed frame selected in rviz?

Asked by ahendrix on 2016-03-07 13:13:46 UTC

A screenshot of rviz would be very helpful in debugging.

Asked by ahendrix on 2016-03-07 13:14:03 UTC

Added the info @ahendrix

Asked by swethmandava on 2016-03-08 00:43:14 UTC

From your screenshot, my best guess is that rviz isn't receiving your message, because you publish immediately after you create the publisher, and the subscriber isn't connected yet. You may want to try publishing continuously or using a latched topic.

Asked by ahendrix on 2016-03-08 01:20:56 UTC

Thank you so much @ahendrix I think the problem seems to be with my sketchup file. I downloaded another collada file off the internet and that seems to work!

Asked by swethmandava on 2016-03-08 03:41:08 UTC

@swethmandava may i knonw where you download the dae file?? becos i am facing the same problem

Asked by ber on 2021-01-31 02:33:47 UTC