mitchellspryn / UrdfSim

Other
104 stars 25 forks source link

unreal block environment #15

Open Jianghn-dev opened 4 years ago

Jianghn-dev commented 4 years ago

hi, I want to know that why is not having .uproject file in the unreal block environment .

thanks

mitchellspryn commented 4 years ago

You might need to run GenerateProjectFiles.bat.

However, note that the blocks environment is unsupported and may not run. The intent is for you to include this plugin in a project of your own.

Jianghn-dev commented 4 years ago

yes,I build my own project finally. I still have tow questions. First,Isn't urdfsim building on linux so far? I try ,always tip “#include Vehicles/AirsimVehicle.h” file not found. Second,how to adjust perspective in airsim? is as below?
"Cameras": { "Follow": { "X": -300, "Y": 30, "Z": 200, "Pitch": -30, "Roll": 0, "Yaw": 0, "AttachLink": "base" }, these parameters is adjusted by what principle

mitchellspryn commented 4 years ago

1) No.

2) I guess by "perspective" you mean the position of the camera following the bot relative to the location of the bot. If so, yes, that is where you adjust it. The "x, y, z" represent the x, y, and z offsets from the link to which you attach. It will remain fixed at this relative location, so if that link moves, the camera will move with it.

Jianghn-dev commented 4 years ago

thank you for your reply. when displaying urdf model, it display red or blue axis and line. How to remove redundant displays?

mitchellspryn commented 4 years ago

Do you have debug mode enabled? If so, turn it off.

If not, please post a picture, as I'm not sure what lines you are referring to.

Jianghn-dev commented 4 years ago

Yes,I turn debug mode off,then it is ok. I find urdfsim supports unreal mesh,but how is unreal mesh UnrealMesh.xml writed? And, in the example file it is not found. The current urdfsim is based on which version of AirSim.

mitchellspryn commented 4 years ago

I don't understand your first question. If you're asking about the 'mesh type="stl_ascii"' tags in the Lunabot Example, then you have to modify the paths in the XML files to point to the absolute paths to where you have the stl files downloaded.

I'm not sure the exact timestamp when the codebases diverged, but I think it was around November last year.

Jianghn-dev commented 4 years ago

first question, I found these as below in your doc If using a static mesh built inside the Unreal Editor, use the same mesh as a custom mesh, but specify a mesh type of 'unreal_mesh', and set the location to the full path of the mesh. This link should have no collision element - the simple collision of the mesh will be used automaticall (complex collision cannot be used, as physics must be simulated). An example can be seen in the UnrealMesh XML in the examples folder. in fact, I don't find UnrealMesh XML in the examples folder.

mitchellspryn commented 4 years ago

Oh. I see.

That is for if you design an mesh inside of unreal (i.e. an asset that inherits from StaticMeshComponent). Then, this parameter should point to the asset path. This is not to be confused with the STL mesh, which has an external file.

Jianghn-dev commented 4 years ago

image i write xml as below,but it is error like picture

    <visual>
      <geometry>
        <mesh type="unreal_mesh" location="C:/Users/Administrator/Desktop/Unreal Project/Block/Blocks/Content/dj1.uasset"/>
      </geometry>
      <material name="metal"/>
    </visual>
mitchellspryn commented 4 years ago

Right, like I said before...you don't use the path on disk when using the unreal mesh. You use the asset path. It would look something like this:

<mesh type="unreal_mesh" location="StaticMesh'/Game/wheel.wheel'" reverse_normals="true" scale_factor="10"/>

Jianghn-dev commented 4 years ago

em..now, after clicking on play button, it has also error. UE4 crash reporter image

Jianghn-dev commented 4 years ago

sorry, I still have question about material setting. It is my xml ,but i found material likely is ignored .

<?xml version="1.0"?>

<robot name="physics">

  <material name="rubber">
    <unreal_material path="Material'/AirSim/VehicleAdv/SUV/AutomotiveMaterials/Materials/Reflector/M_Reflector.M_Reflector'"/>
  </material>
  <material name="metal">
    <unreal_material path="Material'/AirSim/VehicleAdv/SUV/AutomotiveMaterials/Materials/Metal/M_Metal.M_Metal'"/>
  </material>
  <material name="reflector">
    <unreal_material path="Material'/AirSim/VehicleAdv/SUV/AutomotiveMaterials/Materials/Reflector/MI_Reflector_Orange.MI_Reflector_Orange'"/>
  </material>

  <link name="base">
    <visual>
      <geometry>
        <mesh type="stl_ascii" location="C:\Users\Administrator\Documents\AirSim\UrdfBot\box.stl" reverse_normals="true" scale_factor="100"/>
      </geometry>
      <material name="reflector"/>
    </visual>

    <collision>
      <geometry>
        <mesh type="stl_ascii" location="C:\Users\Administrator\Documents\AirSim\UrdfBot\box.stl" reverse_normals="true" scale_factor="100" dynamic_collision_type="vhacd" vhacd_concavity="0.2" vhacd_output_folder_path="C:\Users\Administrator\Documents\AirSim\UrdfBot\LunabotParts\vhacd"/>
      </geometry>
    </collision> 

    <inertial>
      <mass value="1.477" />
      <origin xyz="0 0 0" />
      <inertia ixx="0.01152" ixy="0.0" ixz="0.0" iyy="0.01152" iyz="0.0" izz="0.0218" />
    </inertial>
  </link>

</robot>

image

mitchellspryn commented 4 years ago

I'm not entirely sure what's going on with the stack trace you posted, are you still seeing that error?

Do those materials exist at the paths at which you are referencing them in your unreal project?

Jianghn-dev commented 4 years ago

1 About materials, i use your lunabot model, the materials setting is ok as below.And i use simple box shape, it aslo is ok. But if using quad hector model like above picture, it isn't ok.

Jianghn-dev commented 4 years ago

I found again that if using a custom component stl, material setting is likely ignored. Only simple shapes can be set material(i.e.cylinder、box、ball). I don't know if I set it up wrong.

mitchellspryn commented 4 years ago

That's interesting. In theory, if it works for standard shape (box, ball, etc), it should work for custom shape. They use the same code path.

It makes me wonder if something is getting messed up when reading your STL. Looking at what you've posted above, it looks like it's floating in mid-air. Is collision generated? You can test this by running your project and using the console 'pxvis collision' to see if it's been generated properly.

If you can share your stl, I can take a look.

Jianghn-dev commented 4 years ago

My STL model isn't floating in mid-air, when clicking on the playerbutton, it lands ground. I think collsion is generated. And, above picture, lunabot model seems like that material setting except bottom four cylinders is ignored. This is my STL. quadrotor.stl.zip

mitchellspryn commented 4 years ago

Sorry, just getting time to look at this issue.

It looks like your quadrotor has disconnected parts. I'm not sure how the meshing algorithm will handle that, as it probably expects everything to be 1 contiguous surface.

As a more meta point, I don't think you should be using UrdfSim for quadroters. Presumably, you want it to fly. UrdfSim doesn't handle flying / buoyancy. I'd recommend looking at AirSim. In particular, I know it's possible to create your own drone class, which will handle the physics (more) correctly.