RobotWebTools / ros3djs

3D Visualization Library for use with the ROS JavaScript Libraries
https://robotwebtools.github.io/ros3djs
Other
368 stars 216 forks source link

my urdf in rviz not same in ros3d viewer #625

Closed HESHAM47GAMAL closed 1 year ago

HESHAM47GAMAL commented 1 year ago

Description

Steps To Reproduce

I want to visaulize my robot as appear in rviz

view_3dmap() {

 // Create the main viewer.
 var viewer = new window.ROS3D.Viewer({
    divID : 'urdf',
    width : 800,
    height : 600,
    background : '#EEEEEEE',   
    antialias : true
  });

  // Add a grid.
viewer.addObject(new window.ROS3D.Grid({
  cellSize : 0.5,
  color : '#0099cc'
}));

// Setup a client to listen to TFs.
var tfClient = new window.ROSLIB.TFClient({
  ros : this.state.ros,
  angularThres : 0.01,
  transThres : 0.01,
  rate : 10.0, 
  // fixedFrame : '/base_link'
});

 // Setup the URDF client.
 var urdfClient = new window.ROS3D.UrdfClient({
  ros : this.state.ros,
  tfClient : tfClient,
  rootObject : viewer.scene,
  loader : window.ROS3D.COLLADA_LOADER
});

}

Expected Behavior

Screenshot from 2023-07-13 03-31-48

Actual Behavior

Screenshot from 2023-07-13 03-32-09

MatthijsBurgh commented 1 year ago

I see react issues. I will not help with that. My time is limited.

So please convert to an example without React. When you provide such an example, I am willing to help you.

HESHAM47GAMAL commented 1 year ago

thanks for trying you to help me but I solve my problem my problem that my robot is file.urdf.xacro and start my robot with that conect to remaining links and joint to it that is make big box in react ros3d and to make sure that this link don't any problem should be written by one way of two

  1. only contain inertial
    <inertial>
        <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
        <mass value="1.0"/>
        <inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
    </inertial>

  1. make sure that if use that box size not equal zero make it very small number as you will not face any problem in rviz but in ros3d react make problem like I face
    <visual name="">
        <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
        <geometry>
            <box size="0.01 0.01 0.01"/>
        </geometry>
        <material name="">
            <color rgba="0.0 1.0 1.0 1.0"/>
            <texture filename=""/>
        </material>
    </visual>