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

Masoud's profile - activity

2020-05-06 09:37:04 -0500 marked best answer How to subscribe to a topic whom type is gazebo_msg/ContactState

Hi everybody

I'm trying to write a subscriber following this tutorial) to listen to a topic which is published by a contact sensor (libgazebo_ros_bumper.so). Here is the structure of this topic shown in "topic monitor":

image description

Assuming that we want to write the size of ContactState message published by this topic, I wrote this program and compiled it (using catkin_make command) successfully:

#include "ros/ros.h"
#include "std_msgs/String.h"
#include "gazebo_msgs/ContactState.h"
#include <sstream>

void chatterCallback(const gazebo_msgs::ContactState cs)
{
  int a;
  a = sizeof(cs);
  std::stringstream ss;
  ss << a;
  ROS_INFO("The size of recieved ContactState message is: %d", a);
}

int main(int argc, char **argv)
{

  ros::init(argc, argv, "listener");
  ros::NodeHandle n;
  ros::Subscriber sub = n.subscribe("contact_sensor_state", 1000, chatterCallback);
  ros::spin();

  return 0;
}

However, Nothing happen whenever I run this subscriber node using rosrun command. It seems that ROS never call chatterCallback function. How should I edit ros::Subscriber sub = n.subscribe("contact_sensor_state", 1000, chatterCallback); to fix this issue?

I also have 2 more simple question regarding the above question:

1) How can I store the valued published by "contact_sensor_state/states/[0]/total_wrench/force/z" in a double variable in my program? (Shay answered this question)

2) Is it possible to advertise a variable in my program? I mean is it possible for a node to be both a subscriber and publisher. If yes, how should I edit the code to do this? (Shay answered this question)

I'm using ROS indigo, gazebo 2.2 and ubuntu 14.04.

Thanks

2019-10-06 16:28:09 -0500 received badge  Stellar Question (source)
2019-09-04 05:30:51 -0500 received badge  Notable Question (source)
2019-09-04 05:30:51 -0500 received badge  Famous Question (source)
2019-09-04 05:30:51 -0500 received badge  Popular Question (source)
2018-11-24 01:09:47 -0500 received badge  Favorite Question (source)
2018-09-19 04:23:52 -0500 marked best answer Interpretation of Force/Torque Sensor using gazebo_ros_ft_sensor plugin

I've successfully added a force torque/sensor to my model by adding following codes in my urdf file:

<gazebo reference="shoulder_pan_joint">
    <provideFeedback>true</provideFeedback>
</gazebo>


<gazebo>
    <plugin name="ft_sensor" filename="libgazebo_ros_ft_sensor.so">
        <updateRate>10.0</updateRate>
        <topicName>ft_sensor_topic</topicName>
        <jointName>shoulder_pan_joint</jointName>
    </plugin>
</gazebo>

Although the model is static and nothing is moving in gazebo gui, the outputs of force/torque sensor published by "ft_sensor_topic" is fluctuating. For example the force value that I expect to be -100 is fluctuating between -55 N and -143N. Other 5 components of torque and force values are also fluctuating in a similar range.

I also tried to reduce Gaussian Noise of the sensor by adding <gaussianNoise>0.0</gaussianNoise> to the plugin tag. but this didn't solve the problem.

I'm using gazebo 2.2.3 + Ros indigo running in ubuntu 14.04.

2018-09-18 19:54:54 -0500 marked best answer How to synchronize a ROS publisher node with gazebo simulation time?

Hi everybody

I have an offline trajectory generation program which is written in MATLAB that produce joint trajectories for my humanoid robot. I saved the trajectory in a text file and load it through a ROS publisher node that read the text file line by line and command the desired angle of each joint to corresponding topic of PID controller. Because time step of saved trajectory is 0.02 I set loop rate of publisher to 50Hz.

This publisher work well as long as the simulation runs at normal speed, but when the simulation run slower than normal the PID and simulation are not sync.

I'm wondering if there is a way to send simulation time to publisher in order to command the desired angle of that specific time?

Here is the source code of joint1 publisher node:

   #include "ros/ros.h"
    #include "std_msgs/Float64.h"
    #include <iostream>
    #include <fstream>

    #include <sstream>


    int main(int argc, char **argv)
    {

      ros::init(argc, argv, "talker");

      ros::NodeHandle n;

      ros::Publisher chatter_pub = n.advertise<std_msgs::Float64>("/HumanoidBot/joint1_position_controller/command", 1000);

      ros::Rate loop_rate(50);

      int count = 0;

      std::ifstream inFile;
      inFile.open("example.txt");
      std::string LNN;

      while (ros::ok())
      {

        std_msgs::Float64 msg2;

        getline(inFile,LNN);    

        float temp = ::atof(LNN.c_str());
        msg2.data = temp;


        chatter_pub.publish(msg2);

        ros::spinOnce();

        loop_rate.sleep();

        ++count;
      }


      return 0;
    }
2018-07-05 01:55:39 -0500 received badge  Famous Question (source)
2018-04-19 05:15:13 -0500 received badge  Famous Question (source)
2018-04-19 05:15:13 -0500 received badge  Notable Question (source)
2018-03-14 07:44:02 -0500 received badge  Famous Question (source)
2018-03-14 07:44:02 -0500 received badge  Notable Question (source)
2018-02-21 03:22:56 -0500 received badge  Notable Question (source)
2018-02-21 03:22:56 -0500 received badge  Famous Question (source)
2017-10-25 09:13:58 -0500 received badge  Famous Question (source)
2017-09-21 10:46:41 -0500 received badge  Student (source)
2017-07-20 08:22:54 -0500 received badge  Famous Question (source)
2017-05-19 08:22:33 -0500 received badge  Famous Question (source)
2017-05-18 21:28:58 -0500 received badge  Famous Question (source)
2017-05-17 12:27:10 -0500 received badge  Popular Question (source)
2017-05-14 02:54:59 -0500 asked a question Very small simulation time step for successful walking!!!

Very small simulation time step for successful walking!!! Dear ROS community I need to simulate and control a simple 3

2017-04-24 01:29:20 -0500 commented question UDP socket (publishing to topic)

Hello Did you find the solution? Can you help me for similar question?

2017-04-22 02:37:49 -0500 answered a question Receiving Data over UDP through node

I searched the net for similar programs. Here I found a package named comm_tcp that seems similar to the one I need. But

2017-04-22 00:43:54 -0500 received badge  Notable Question (source)
2017-04-19 17:09:57 -0500 received badge  Popular Question (source)
2017-04-18 23:15:27 -0500 edited question Receiving Data over UDP through node

Receiving Data over UDP through node Hello everybody I am using a custom CAN to LAN converter board and switch to conn

2017-04-18 23:13:47 -0500 asked a question Receiving Data over UDP through node

Receiving Data over UDP through node Hello everybody I am using a custom CAN to LAN converter board and switch to conn

2017-04-18 23:01:12 -0500 commented answer Sending Data over UDP through Node

I also found this package. https://github.com/abhinavjain241/comm_tcp but it is using TCP/IP protocols to communicate w

2017-04-18 22:59:01 -0500 commented answer Sending Data over UDP through Node

Hi @felixwatzlawik It seems that I have the same problem as your because I want to read some encoders output through UD

2017-04-12 09:03:26 -0500 received badge  Famous Question (source)
2017-01-19 00:28:08 -0500 marked best answer Why joint position controller is not sensitive to changing PID gains?

Dear Ros Users

I'm going to use ziegler-nichols method to tune PID gains of an simple inverted pendulum model. I'm wondering why my controller whom type is "position_controllers/JointPositionController", is not sensitive to changing PID gains. Even in the case of setting all k_p, k_i and k_d to zero in following YAML configuation file, controller works well as before.

inverted_pendulum:
  # Publish all joint states -----------------------------------
  joint_state_controller:
    type: joint_state_controller/JointStateController
    publish_rate: 50  

  # Position Controllers ---------------------------------------
  joint1_position_controller:
    type: position_controllers/JointPositionController
    joint: shoulder_pan_joint
    pid: {p: 0.0, i: 0.0, d: 0.0}

And this is the snippets of the urdf model:

  <joint name="shoulder_pan_joint" type="revolute">

    <parent link="Link1"/>

    <child link="Rod"/>

    <!--<origin xyz="0 0.15 0.65" rpy="0 0 0" />-->

    <origin xyz="0 -0.015 0.65" rpy="0 0 0" />

    <axis xyz="0 1 0" />

    <limit effort="300" velocity="1" lower="-2.61799387799" upper="1.98394848567"/>

    <dynamics damping="5" friction="0.1"/>

  </joint>

      <transmission name="tran1">

        <type>transmission_interface/SimpleTransmission</type>

        <joint name="shoulder_pan_joint">
          <hardwareInterface>PositionJointInterface</hardwareInterface>
        </joint>

        <actuator name="motor1">
          <hardwareInterface>PositionJointInterface</hardwareInterface>
          <mechanicalReduction>1</mechanicalReduction>
        </actuator>

      </transmission>

<gazebo reference="shoulder_pan_joint">
    <provideFeedback>true</provideFeedback>
    <disableFixedJointLumping>true</disableFixedJointLumping>
</gazebo>

  <!-- ros_control plugin -->
  <gazebo>
    <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
      <robotNamespace>/inverted_pendulum</robotNamespace>
    </plugin>
  </gazebo>

Would you please help me to resolve this issue?

I'm using Ubuntu 14.01 and ROS indigo.

2017-01-18 09:20:31 -0500 received badge  Famous Question (source)
2017-01-18 04:25:14 -0500 received badge  Notable Question (source)
2017-01-17 08:49:07 -0500 marked best answer Using MoveIt to solve COM based Inverse Kinematic

Dear ROS users

Is it possible to use MoveIt to solve inverse kinematic of a manipulator based on position of arm center of mass (COM) in task space?

For example, consider a double inverted pendulum. Can MoveIt give us joint angles that sets the total center of mass of robot (double inverted pendulum) to specific feasible point in workspace?

Thanks for your considerations

2017-01-17 08:48:53 -0500 received badge  Notable Question (source)
2017-01-09 08:16:51 -0500 marked best answer Best Gazebo + ROS versions for installing on Ubuntu 14.04 on vmware

Hello people

For accomplishing my master thesis I need to simulate our humanoid robot in Gazebo. I prefer to control the robot through MATLAB using ROS nodes. I installed ubuntu 14.04 on vmware. Now I'm a little confused about choosing the right compatible versions of Gazebo and ROS. Would you guys please help me decide..

Please consider following details in your suggestion:

1) The robot should have IMU (Inertial Measurement Unit), Encoders and 6 axis Force/Torque sensor at ankle or equivalently 4 contact force sensor at each foot (2 contact force sensor for each toe and heel)

2) I need a version of Gazebo that supports all 4 available Dynamic engines (e.g. ODE, DART, Bullet and SIMBODY) to examine the accuracy of each one for contact forces based on solving LCP. Maybe gazebo 3+ as I know.

3) I prefer a version of Gazebo that supports adding noise without having to write sensor plugins.

4) I need to model two closed chain using ball screw joints for actuating knee joint. So I have to use SDF instead of URDF for modeling.

5) I want to have control over simulation step time and controller update rate when using MATLAB to control the robot.

after reading through different tutorials about gazebo and ROS, I realized that maybe I have to install ROS jade but I'm a little worried about this note that "currently in ROS Jade there is no ros-jade-gazebo-ros-control package released" as mentioned here.

I looked over the net for an image of preconfigured gazebo and ros jade, but I couldn't find any except the one that mathworks has provided here which is based on Kubuntu and Gazebo 1.9.6 and ros hydro. I'll upload my vmware images for others after installing and configuring the most stable and updated versions of gazebo and ros.

Considering my application do you recommend using unsupported version of gazebo and ros using catkin workspace or not?

Regards

2016-12-09 10:32:36 -0500 received badge  Notable Question (source)
2016-11-14 21:52:28 -0500 received badge  Famous Question (source)
2016-11-05 15:44:18 -0500 received badge  Popular Question (source)
2016-11-02 06:12:52 -0500 asked a question Showing visual element in Gazebo that has no physics from ROS node?

Hello everybody

I'm wondering is there a way to add simple geometry shapes (e.g. sphere and line) from a running ROS node?

I have a humanoid robot that walks successfully and I want to visualize, COG, ZMP and support convex hull in gazebo GUI. Currently I have a node that computes the location of COG and ZMP in each time step, and all I want is to draw two sphere in gazebo that coincide with ZMP and COG location.

Thanks for your attention