Home | Tutorials | Wiki | Issues
Ask Your Question

Masoud's profile - activity

2017-06-28 14:07:34 -0500 received badge  Famous Question (source)
2017-06-12 03:22:51 -0500 received badge  Famous Question (source)
2017-05-18 02:46:25 -0500 received badge  Notable Question (source)
2017-05-16 09:22:15 -0500 received badge  Popular Question (source)
2017-05-15 01:56:07 -0500 edited question Very small simulation time step for successful walking!!!

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

2017-05-15 01:55:32 -0500 edited question Very small simulation time step for successful walking!!!

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

2017-05-15 01:53:36 -0500 edited question Very small simulation time step for successful walking!!!

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

2017-05-15 01:38:27 -0500 asked a question Very small simulation time step for successful walking!!!

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

2016-12-29 09:28:00 -0500 received badge  Famous Question (source)
2016-12-18 13:48:45 -0500 received badge  Popular Question (source)
2016-12-18 13:48:45 -0500 received badge  Notable Question (source)
2016-10-11 03:49:40 -0500 received badge  Notable Question (source)
2016-09-29 07:28:33 -0500 received badge  Student (source)
2016-09-27 02:06:43 -0500 received badge  Supporter (source)
2016-09-25 06:28:16 -0500 answered a question Changing physics engine through URDF

I'm writing this just to bring the question at top to attract attention..

2016-09-25 05:51:28 -0500 commented answer Changing physics engine through URDF

Thank you JLivero... I'm also wondering if there is a similar way to change maximum_step_size through editing empty_world.lanuch ?

2016-09-25 05:50:20 -0500 received badge  Scholar (source)
2016-09-25 05:40:26 -0500 received badge  Famous Question (source)
2016-09-25 05:40:06 -0500 commented question How to subscribe to a topic whom type is gazebo_msg/ContactState?
2016-09-24 07:15:07 -0500 asked a question 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 the 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?

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?

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

Thanks

2016-09-22 09:19:43 -0500 received badge  Popular Question (source)
2016-09-18 01:28:13 -0500 asked a question Synchronizing a ROS publisher node with gazebo 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;
}
2016-09-18 00:37:26 -0500 received badge  Enthusiast
2016-09-14 20:37:05 -0500 received badge  Notable Question (source)
2016-09-12 14:07:54 -0500 received badge  Popular Question (source)
2016-09-10 08:55:51 -0500 received badge  Editor (source)
2016-09-10 08:53:58 -0500 asked a question Changing physics engine through URDF

Hi everybody

Would you please tell me that how can I change physics engine (eg. ODE, Bullet , ...) through launch file and URDF. I have created a package that contains one xacro file (which is used to model and inverted pendulum) and two launch file that are as follow:

///////////////// Inverted_pendulum_world.launch ////////////////

<launch>

  <!-- these are the arguments you can pass this launch file, for example paused:=true -->
  <arg name="paused" default="false"/>
  <arg name="use_sim_time" default="true"/>
  <arg name="gui" default="true"/>
  <arg name="headless" default="false"/>
  <arg name="debug" default="false"/>

  <!-- We resume the logic in empty_world.launch -->
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="debug" value="$(arg debug)" />
    <arg name="gui" value="$(arg gui)" />
    <arg name="paused" value="$(arg paused)"/>
    <arg name="use_sim_time" value="$(arg use_sim_time)"/>
    <arg name="headless" value="$(arg headless)"/>
  </include>

  <!-- Load the URDF into the ROS Parameter Server -->
  <param name="robot_description" command="$(find xacro)/xacro.py '$(find ip_cloned)/urdf/inverted_pendulum.xacro'" />


  <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
   <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
    args="-urdf -model inverted_pendulum -param robot_description"/>


</launch>

////////////////////Inverted_pendulum_gazebo_control.launch /////////////////

<launch>
  <!-- Launch Gazebo  -->
  <include file="$(find ip_cloned)/launch/inverted_pendulum_world.launch" />   


  <!-- Load joint controller configurations from YAML file to parameter server -->
  <rosparam file="$(find ip_cloned)/config/inverted_pendulum_gazebo_control.yaml" command="load"/>


  <!-- load the controllers -->
  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
    output="screen" ns="/inverted_pendulum" args="joint_state_controller
                      joint1_position_controller"/>


  <!-- convert joint states to TF transforms for rviz, etc -->
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
    respawn="false" output="screen">
    <remap from="/joint_states" to="/inverted_pendulum/joint_states" />
  </node>

</launch>

I'm using gazebo 2.2 + Ubuntu 14.04 + ROS Indigo

Thanks

2016-06-29 04:11:24 -0500 received badge  Famous Question (source)
2016-06-16 00:34:26 -0500 received badge  Notable Question (source)
2016-05-17 23:31:28 -0500 received badge  Popular Question (source)
2016-05-16 09:46:02 -0500 asked a question Controlling an Inverted pendulum using simple proportional Controller from Matlab

Hello people I'm trying to control an inverted pendulum using MATLAB. I have successfully created the model and applied constant joint torques using following codes in MATLAB:

ipaddress = '192.168.x.x';
rosinit(ipaddress)
gazebo = ExampleHelperGazeboCommunicator();
PendulumModel = ExampleHelperGazeboModel('1link','gazeboDB');
Pendulum = spawnModel(gazebo,PendulumModel,[0 0 0]);
[links, joints] = getComponents(Pendulum);
stopTime = 50; % Seconds
effort = 2 * 10 * 0.8; % Newton-meters
jointTorque(Pendulum, joints{1}, stopTime, effort);

My main problem is that I can't feedback the pendulum joint angle in MATLAB. Would you please help me to get joint angles in MATLAB.

Additional Info: MATLAB version : R2016a Running Kubuntu through vmware player which has ros hydro installed and configured to connect to MATLAB

SDF Model file:

<?xml version='1.0'?>
<sdf version='1.4'>
  <model name="Pendulum">
   <static>false</static>
      <link name='link1'>
        <pose>0 0 2.4 0 0 0</pose>
        <collision name='collision1'>
          <geometry>
        <cylinder>
          <radius>.1</radius>
          <length>.8</length>
        </cylinder>
          </geometry>
        </collision>

        <visual name='visual1'>
          <geometry>
            <cylinder>
              <radius>0.1</radius>
              <length>0.8</length>
            </cylinder>
          </geometry>
        </visual>

    <inertial>
      <pose>0 0 0.4 0 0 0</pose>
      <inertia>
    <ixx>0.058640</ixx>
    <ixy>0.000124</ixy>
    <ixz>0.000615</ixz>
    <iyy>1.058786</iyy>
    <iyz>0.000014</iyz>
    <izz>1.532440</izz>
      </inertia>
      <mass>2.000</mass>
    </inertial>
  </link>
<joint type="revolute" name="joint1">
  <pose>0 0 -0.4 0 0 0</pose>
  <child>link1</child>
  <parent>world</parent>
  <axis>
    <xyz>0 1 0</xyz>
  </axis>
</joint>
  </model>
</sdf>

With Thanks Masoud