how to get the touch sensor reading

Discussion in 'Modeling' started by legatoYuan, Feb 16, 2019.

  1. Hi. I've attached a touch sensor on the marble which defined in senen.xml flie. I want to simulate the cloth.xml(this file includes the scene.xml) and read the touch sensor data. However, when I run
    Code:
    ./simulate ../model/cloth
    , I get the such a screenshot(attached to this post), there is no way to read the sensor reading, also I can't drag the cloth by the mouse(from the demo video, I think I should be able to interact with the object ). Can you tell me which steps I'm missing? Thank you so much!
    Code:
    <mujoco>
        <!--  Copyright © 2018, Roboti LLC
    
              This file is licensed under the MuJoCo Resource License (the "License").
              You may not use this file except in compliance with the License.
              You may obtain a copy of the License at
    
                https://www.roboti.us/resourcelicense.txt
        -->
    
        <statistic extent="2" meansize=".05"/>
    
        <option timestep="0.005" solver="Newton" iterations="30" tolerance="1e-10" jacobian="sparse" cone="pyramidal"/>
    
        <visual>
            <rgba haze="0.15 0.25 0.35 1"/>
            <quality shadowsize="2048"/>
            <map stiffness="700" shadowscale="0.5" fogstart="10" fogend="15" zfar="40" haze="0.3"/>
        </visual>
    
        <asset>
            <texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0 0 0" width="512" height="512"/>
            <texture name="texplane" type="2d" builtin="checker" rgb1=".2 .3 .4" rgb2=".1 0.15 0.2"
                width="512" height="512" mark="cross" markrgb=".8 .8 .8"/>
            <texture name="texcarpet" type="2d" file="carpet.png"/>
            <texture name="texsponge" type="2d" file="sponge.png"/>
            <texture name="texmarble" type="cube" file="marble.png"/>
    
            <material name="matplane" reflectance="0.3" texture="texplane" texrepeat="1 1" texuniform="true"/>
            <material name="matcarpet" texture="texcarpet"/>
            <material name="matsponge" texture="texsponge" specular="0.3"/>
            <material name="matmarble" texture="texmarble" rgba=".7 .7 .7 1"/>
        </asset>
    
        <worldbody>
            <light directional="true" diffuse=".4 .4 .4" specular="0.1 0.1 0.1" pos="0 0 5.0" dir="0 0 -1" castshadow="false"/>
            <light directional="true" diffuse=".6 .6 .6" specular="0.2 0.2 0.2" pos="0 0 4" dir="0 0 -1"/>
    
            <geom name="ground" type="plane" size="0 0 1" pos="0 0 0" quat="1 0 0 0" material="matplane" condim="1"/>
    
            <body mocap="true" pos="-.1 .05 0" zaxis=".5 0 1">
                <geom type="capsule" size=".1 .1" material="matmarble" group="1" condim="1"/>
                <site name="s_pin_L" group="3" type="sphere" pos="0.0848666666666667 0 0.03945" size="0.01" rgba="0 0 1 .5" />
            </body>
        </worldbody>
        <sensor>
          <touch name="sensor_touch_Ltoe" site="s_pin_L" />
        </sensor>
    </mujoco>
     

    Attached Files:

  2. The documentation clearly states the respective fields for sensor readings.
     
  3. can you be more specific? I mean, I've add the sensor into .xml but have trouble to display its reading, not sure what I'm missing.
     
  4. sorry to ask such a stupid question
     
  5. The

    mjtNum* sensordata; // sensor data array (nsensordata x 1)

    field contains the sensor readings. I think the v 2.0 simulate.cpp lets you visually inspect this in the "Watch" tab.