Ask Your Question

Giacomo's profile - activity

2018-05-28 03:18:52 -0600 received badge  Necromancer (source)
2018-05-28 03:18:52 -0600 received badge  Teacher (source)
2015-10-12 12:45:05 -0600 received badge  Famous Question (source)
2015-05-21 09:04:52 -0600 received badge  Famous Question (source)
2014-04-14 18:15:44 -0600 received badge  Popular Question (source)
2014-04-14 18:15:44 -0600 received badge  Notable Question (source)
2013-12-03 03:49:47 -0600 received badge  Famous Question (source)
2013-04-28 01:30:04 -0600 asked a question Calling setModelConfiguration service within a gazebo plugin/controller

Hi, I'm trying to modify the gazebo_ros_laser plugin simply adding a function (just before the PutLaserData() method) to move the joint in a way that the sensor can tilt a certain angle and I'm using the gazebo set_model_configuration service cause I don't need dynamics. If a create a stand-alone node or I try from the command line it works, but when I try within the controller source file gazebo gets stuck or fails to call the service. If I try with:

this->client_ = this->rosnode_->serviceClient<gazebo_msgs::SetModelConfiguration>("set_model_configuration");

the call fails. With:

this->client_ = this->rosnode_->serviceClient<gazebo_msgs::SetModelConfiguration>("/gazebo/set_model_configuration");

gazebo gets stuck. The function I'm using is this:

void MyClass::UpdateJointPos()
{
  unsigned int index = 0;
  gazebo_msgs::SetModelConfiguration srv;
  srv.request.model_name = this->modelParent->GetName();
  srv.request.urdf_param_name = "robot_description";
  srv.request.joint_names.assign(1, this->modelParent->GetJoint(index)->GetName());
  srv.request.joint_positions.assign(1, this->jpositions[count]);

  if (!this->client_.call(srv)) ROS_ERROR("Failed to call the service");
}

I printed the value I send and they are correct. I wonder if I use an incorrect name to call the service but I tried every combination. I tried even to set the joint position by this->modelParent->GetJoint(index)->..something but there is no SetPosition() function or similar. I really need your help.

2013-04-08 07:49:35 -0600 received badge  Notable Question (source)
2013-04-08 07:49:35 -0600 received badge  Popular Question (source)
2013-03-17 03:02:51 -0600 asked a question Pressure sensor implementation

I'm implementing a tape pressure sensor (like this: http: //cnmat.berkeley.edu/system/files/sensor_modules/IMG_7786.jpg) in gazebo as a small link with attached a bumper to keep track of the contacts and measure the total_wrench acting on it (in particular to the z-axis component). This is my urdf:

<robot name="pressure_sensor">

  <link name="base_link">
    <inertial>
      <mass value="0.001"/>
      <origin xyz="0 0 0.0005"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <box size="0.1 0.5 0.1"/>
      </geometry>
    </visual>
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <box size="0.1 0.5 0.001"/>
      </geometry>
    </collision>
  </link>

  <gazebo reference="base_link">
    <sensor:contact name="contact_sensor">
    <geom>base_link_geom</geom>
    <updateRate>1.0</updateRate>
    <controller:gazebo_ros_bumper name="gazebo_ros_bumper_controller" plugin="libgazebo_ros_bumper.so">
          <alwaysOn>true</alwaysOn>
          <updateRate>1.0</updateRate>
          <bumperTopicName>weight</bumperTopicName>
          <interface:bumper name="bumper_iface" />
        </controller:gazebo_ros_bumper>
    </sensor:contact>
  </gazebo>

</robot>

and this is the callback function of the bumper topic "weight" subscriber node:

void pressureCallback(const gazebo_msgs::ContactsState::ConstPtr& msg){
    if(msg != NULL && msg->states.size()>0) {
        sum=0;
        for(i=0;i<msg->states.size(); i++){
            if((msg->states[i].geom2_name).compare("[MY_LINK_GEOM]")==0) {
                if(msg->states[i].total_wrench.force.z >= 0) sum+=msg->states[i].total_wrench.force.z;
                else sum-=msg->states[i].total_wrench.force.z;
            }
        }
        ROS_INFO("Weight detected: %f Kg", sum);
    }

where [MY_LINK_GEOM] is the name of the link - of the object I want to measure the weight - that touches my pressure sensor.

It seems to work but I cannot understand why the weight measurements vary in such a different way with the time passing as shown in the figure: https: //www.dropbox.com/s/98lepyi5015ew56/pressure1.png. Is there in your opinion a better implementation for that?

2013-03-07 05:20:02 -0600 received badge  Notable Question (source)
2013-03-06 21:54:14 -0600 commented answer Get state of all links in a model in gazebo?

I forgot one important thing: the link has to be the root link of the robot.

2013-03-06 21:42:52 -0600 received badge  Editor (source)
2013-03-06 21:41:34 -0600 answered a question Get state of all links in a model in gazebo?

The correct sintax to get the state of the link you are interested on is:

rosservice call /gazebo/get_link_state 'link_name: MODEL_NAME::LINK_NAME'

Link names are prefixed by model name, e.g. pr2::base_link.

The same for the second command, the correct sintax is:

rosservice call /gazebo/get_link_properties 'link_name: MODEL_NAME::LINK_NAME'
2013-01-20 22:08:09 -0600 received badge  Popular Question (source)
2013-01-18 08:14:30 -0600 asked a question Access Gazebo main camera parameters

Is there a way to access the parameters of the Gazebo main camera to retrieve for example the light intensity of a certain point in the space?

2013-01-18 05:26:07 -0600 answered a question How to simulate a simple light sensor in Gazebo?

When Gazebo renders the scene theoretically it should calculate the color (and thus the brightness) of each point in the scene. Is there a way to access the parameters of the Gazebo main camera to retrieve the light intensity?

2013-01-18 04:34:34 -0600 received badge  Supporter (source)