ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Visualize collada file on rviz [closed]

asked 2016-03-07 00:16:14 -0500

swethmandava gravatar image

updated 2016-03-13 03:26:49 -0500

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()
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by swethmandava
close date 2016-03-08 02:41:52.957403

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-03-07 01:30:30 -0500

ahendrix gravatar image

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

edit flag offensive delete link more

Comments

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

gvdhoorn gravatar image gvdhoorn  ( 2016-03-07 01:50:42 -0500 )edit

@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

swethmandava gravatar image swethmandava  ( 2016-03-07 02:23:16 -0500 )edit

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?

ahendrix gravatar image ahendrix  ( 2016-03-07 12:13:46 -0500 )edit

A screenshot of rviz would be very helpful in debugging.

ahendrix gravatar image ahendrix  ( 2016-03-07 12:14:03 -0500 )edit

Added the info @ahendrix

swethmandava gravatar image swethmandava  ( 2016-03-07 23:43:14 -0500 )edit

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.

ahendrix gravatar image ahendrix  ( 2016-03-08 00:20:56 -0500 )edit
1

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!

swethmandava gravatar image swethmandava  ( 2016-03-08 02:41:08 -0500 )edit

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

ber gravatar image ber  ( 2021-01-31 01:33:47 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-03-07 00:16:14 -0500

Seen: 741 times

Last updated: Mar 13 '16