Home | Tutorials | Wiki | Issues
Ask Your Question

niall's profile - activity

2016-01-24 10:52:35 -0500 received badge  Famous Question (source)
2016-01-24 10:52:35 -0500 received badge  Notable Question (source)
2015-11-17 21:34:26 -0500 received badge  Famous Question (source)
2015-11-17 21:34:26 -0500 received badge  Notable Question (source)
2015-11-17 21:34:26 -0500 received badge  Popular Question (source)
2015-10-20 09:03:40 -0500 answered a question How can I control a simple model using the keyboard?

Is there a specific reason why you don't want to use ROS? Moving around a model (with a controller) is exactly what ROS is good for. You could make a gazebo model plugin that captures key presses and then moves around a model by resetting it's position each time but you would have to write your own controller. Gazebo ROS plugins already have such functionality.

2015-10-20 09:02:32 -0500 answered a question How can I control a simple model using the keyboard?

Is there a specific reason why you don't want to use ROS? Moving around a model (with a controller) is exactly what ROS is good for. You could make a gazebo model plugin that captures key presses and then moves around a model by resetting it's position each time but you would have to write your own controller. Gazebo ROS plugins already have such functionality.

2015-09-25 06:08:47 -0500 received badge  Famous Question (source)
2015-09-21 18:53:51 -0500 received badge  Famous Question (source)
2015-09-17 16:19:57 -0500 commented answer Plugin problem launching .launch

I'm sorry, I can't find what you're doing wrong. Not a C++ guru myself. What helped me was follow this part of the error: "undefined symbol: _ZN6gazebo20GazeboRosCameraUtilsC2Ev". The gazebo part likely means the problem originates in that namespace, in the GazeboRosCameraUtils part with a function starting with "Ev". That's how I found my error.

2015-09-15 04:09:36 -0500 answered a question Rpeatable results in gazebo

When you say different positions, I expect you mean different velocities or position changes as if you set the velocity constant, the position will never be constant...

So how different are your velocities? If they are slightly different I wouldn't be worried. If you're running hector_quadrotor with all it's plugins there is a lot (!) going on. For one there are aerodynamics and propulsion plugins that could cause the results to be different every time. The drag and propeller forces are calculated each step and these could vary considerably each simulation. Also are you using ground_truth for pose estimation or the imu? Here again the imu is of course more realistic but less accurate and can cause differences. You can even add wind to the simulation which changes the results. I don't know how much of this you have changed but I think it's good to know a lot of things can influence your results.

2015-09-14 06:15:33 -0500 commented question Plugin problem launching .launch

And also your plugin source code? I had this error not that long ago and it was something silly like having an old function declared in the header but not defined.

2015-09-14 03:33:07 -0500 commented answer Spawn hector quadrotor in custom gazebo world.

Yes and yes. Save it as .world instead of .sdf and if you look at the last command of world.launch you see the node `gazebo_ros` is started.

2015-09-14 03:29:05 -0500 commented answer Get realtimefactor through plugin (programmatically)

Thanks evilBiber. Yes I figured such but as you say, averaged over a second, a few millis, this is different. I was hoping I could get the exact number the way Gazebo GUI calculates it. And figured, since Gazebo calculates it anyway, there would be a function for this.

2015-09-14 03:18:40 -0500 received badge  Notable Question (source)
2015-09-14 02:22:23 -0500 received badge  Good Answer (source)
2015-09-14 00:48:46 -0500 received badge  Popular Question (source)
2015-09-13 20:36:52 -0500 received badge  Nice Answer (source)
2015-09-13 09:50:37 -0500 answered a question Spawn hector quadrotor in custom gazebo world.

Sure you can. I did exactly this with lots of worlds by just creating a catkin package called quad_world with a launch file in it that spawns the quadcopter and all kinds of other stuff (I used quadrotor_empty_world.launch as base).

As follows: start.launch contains:

<arg name="world_name" default="$(find quad_world)/worlds/tonystart124.world" />
<include file="$(find quad_world)/launch/world.launch">
  <arg name="world_name" default="$(arg world_name)"/>
</include>

<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch" />

world.launch is the following: <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="headless" default="false"/>
  <arg name="debug" default="false"/>
  <arg name="verbose" default="false" />

  <arg name="world_name" />

  <!-- set use_sim_time flag -->
  <group if="$(arg use_sim_time)">
    <param name="/use_sim_time" value="true" />
  </group>

  <!-- set command arguments -->
  <arg unless="$(arg paused)" name="command_arg1" value=""/>
  <arg     if="$(arg paused)" name="command_arg1" value="-u"/>
  <arg unless="$(arg headless)" name="command_arg2" value=""/>
  <arg     if="$(arg headless)" name="command_arg2" value="-r"/>
  <arg unless="$(arg verbose)" name="command_arg3" value=""/>
  <arg     if="$(arg verbose)" name="command_arg3" value="--verbose"/>
  <arg unless="$(arg debug)" name="script_type" value="gzserver"/>
  <arg     if="$(arg debug)" name="script_type" value="debug"/>

  <!-- start gazebo server-->
  <node name="gazebo" pkg="gazebo_ros" type="$(arg script_type)" respawn="false" output="screen"
    args="$(arg command_arg1) $(arg command_arg2) $(arg command_arg3) $(arg world_name)" />

  <!-- start gazebo client -->
  <node name="gazebo_gui" pkg="gazebo_ros" type="gzclient" respawn="false" output="screen"/>


</launch>

Good luck with your project!

2015-09-13 09:08:18 -0500 commented question Get realtimefactor through plugin (programmatically)

OK so my second method worked by creating a world plugin that subscribes to the gz topic ~/diagnostics and then publish this to a ROS topic but this obviously isn't ideal. Still interested in a solution where I can get it from for instance the WorldPtr somehow.

2015-09-13 02:12:28 -0500 received badge  Student (source)
2015-09-11 10:07:44 -0500 asked a question Get realtimefactor through plugin (programmatically)

Hi,

I've been trying to get the current realtime factor programmatically. I tried getting it through a world plugin but cannot find a get function, only for real time and Sim time. I know it's inside the /diagnostics topic and also am trying to subscribe to that topic through a plugin but it seems a little unhandy this way. Is there another method to get the real time factor programmatically?

2015-09-11 08:01:35 -0500 commented answer Get real time factor from a headless gazebo

I'm trying to do the same thing but was looking for a way of doing it with a plugin. I found GetRealTime() in a modelplugin but can't find the realtime factor. How did you end up doing it exactly?

2015-09-07 04:44:34 -0500 received badge  Citizen Patrol
2015-09-03 09:54:12 -0500 commented answer peek - Finding location of models after specified time

Did you try use_sim_time? This will sync Gazebo and ROS clock. With run as fast as you want I mean it can be set to run every time a callback is received from clock, that is a lot faster then you want to do anything.

2015-09-02 15:33:25 -0500 answered a question peek - Finding location of models after specified time

I expect when you say you're using ROS Service that you're calling it from the command line? If so then yes it will always be a little off.

You could write a ROS node that checks the rostopic /clock and if the time is right, calls the service get_model_state to get your model position. You have to enable use_sime_time when starting Gazebo though to make sure the clocks are synchronized (http://answers.gazebosim.org/question/3172/timing-synchronisation-between-gazebo-and-ros/). The node can run as fast as you want so it will check the time every Gazebo iteration making it fast enough for your needs I expect. Good luck!

2015-09-02 15:09:05 -0500 received badge  Popular Question (source)
2015-09-02 14:12:32 -0500 commented question How to schedule forces at specific times?

Sorry, I meant to link this: http://gazebosim.org/tutorials/?tut=ros_comm, but I expect you found it by now. Like evilBiber says you can also use Gazebo's message system (protobufs: http://www.gazebosim.org/tutorials?tut=topics_subscribed&cat=transport). I expect like you say it will be faster because it speaks directly to the Gazebo API instead of through ROS API.

2015-09-02 14:08:06 -0500 commented question Complex model sometimes (1:4x) opens gazebo with black screen

Gazebo 5.1.0

2015-08-27 09:06:37 -0500 commented answer Getting forces from Gazebo in ROS with pygazebo

OK so basically I used the tutorial on creating a standalone subscriber for Gazebo. Got that working with ROS included and went on from there. Use Qtcreator as editor (open cmake file) to easily see what members/classes are available. Here's my code: http://pastebin.com/GmyBb6cx

Excuse my ugly coding. It's not a very fancy project so yes global variables and all... :)

2015-08-27 07:26:46 -0500 asked a question Complex model sometimes (1:4x) opens gazebo with black screen

Hi,

I'm running a (seemingly) reasonably complex model where a population grid is created of very simple rectangular wall parts. Like so:

<population name="dirty_grid">
  <model name="dirty_element">
    <include>
      <uri>model://dirty_element2</uri>
    </include>
  </model>
  <pose>0.3 0 1.225 1.5707 0 1.5707</pose>
  <distribution>
    <type>grid</type>
    <rows>5</rows>
    <cols>5</cols>
    <step>0.0125 0.0125 0</step>
  </distribution>
</population>

The problem is that Gazebo sometimes doesn't open correctly (about 1:4 times). It starts at 0.1x realtime and slowly moves up (in about 3 seconds) but when it is at 0.9x realtime the screen is still black. I can imagine this is the time that Gazebo takes to create the population of models but don't understand why it sometimes works fine and other times does not.

Have tried debugging but I can't see anything different from when it works fine and when a black screen appears. Any tips?

2015-08-18 14:33:38 -0500 received badge  Famous Question (source)
2015-08-11 13:40:20 -0500 received badge  Famous Question (source)
2015-07-31 16:52:19 -0500 commented question How to schedule forces at specific times?

Yes there actually is, through services: http://answers.gazebosim.org/question/9079/how-to-schedule-forces-at-specific-times/. As is explained here you can set the start time and duration of the wrench you want to apply. But This is only really practical for doing it once or twice (from the command line). My best guess would be create a model plugin that you can send ROS messages to from another node when and what force you want to apply.

2015-07-31 16:47:51 -0500 received badge  Commentator
2015-07-30 07:22:44 -0500 commented question How to schedule forces at specific times?

Or you could write a model plugin (http://gazebosim.org/tutorials/?tut=plugins_model) to apply forces a prescribed times. The plugin runs every iteration so I doubt this would suffer any delay. If you don't need to create this time instances on the fly, this might due.

2015-07-29 05:11:51 -0500 asked a question Subscribing to ROS and Gazebo topic in one node

Hi,

I have a node which successfully subscribes to a contacts topic in Gazebo. Now I want the same node to subscribe to a ROS topic which of course runs through a separate callback. Unfortunately the ROS callback is not being run, only the Gazebo callback. Is there something I'm missing here? Are the publishers/subscribers from ROS and Gazebo conflicting?

Here is my code:

#include <gazebo/transport/transport.hh>
#include <gazebo/msgs/msgs.hh>
#include <gazebo/gazebo.hh>
#include <nav_msgs/Odometry.h>
#include <ros/ros.h>
#include <geometry_msgs/Vector3.h>

#include <iostream>

ros::Publisher pub;
bool airborn;

// Forces callback function
void forcesCb(ConstContactsPtr &_msg){
    geometry_msgs::Vector3 msgForce;
    // What to do when callback
    //std::cout << "in forces callback " << airborn << '\n';
    if ( _msg->contact_size()!= 0){/*
        std::cout << "x = " << _msg->contact(0).wrench().Get(0).body_1_wrench().force().x() << ", "
                  << "y = " << _msg->contact(0).wrench().Get(0).body_1_wrench().force().y() << ", "
                  << "z = " << _msg->contact(0).wrench().Get(0).body_1_wrench().force().z()
                  << '\n'; */
        // Now publish
        msgForce.x = _msg->contact(0).wrench().Get(0).body_1_wrench().force().x();
        msgForce.y = _msg->contact(0).wrench().Get(0).body_1_wrench().force().y();
        msgForce.z = _msg->contact(0).wrench().Get(0).body_1_wrench().force().z();
        pub.publish(msgForce);
    } else if (airborn = false) {
        //std::cout << "Collision but not airborn" << '\n';
        msgForce.x = 0;
        msgForce.y = 0;
        msgForce.z = 0;
    } else {
        //std::cout << "No collision" << '\n';
        msgForce.x = 0;
        msgForce.y = 0;
        msgForce.z = 0;
    }
    pub.publish(msgForce);
}

// Position callback function
void positionCb(const nav_msgs::Odometry::ConstPtr& msg2){
    std::cout << "in position callback" << '\n';
    if (msg2->pose.pose.position.z > 0.3) {
        airborn = true;
        std::cout << "position =" << msg2->pose.pose.position.z  << "airborn =" << airborn << '\n';
    } else {
        airborn = false;
    }
}

int main(int _argc, char **_argv){
  // Set variables
  airborn = false;
  std::cout << "airborn = " << airborn << '\n';

  // Load Gazebo & ROS
  gazebo::setupClient(_argc, _argv);
  ros::init(_argc, _argv, "force_measure");

  // Create Gazebo node and init
  gazebo::transport::NodePtr node(new gazebo::transport::Node());
  node->Init();

  // Create ROS node and init
  ros::NodeHandle n;
  pub = n.advertise<geometry_msgs::Vector3>("forces", 1000);

  // Listen to Gazebo contacts topic
  gazebo::transport::SubscriberPtr sub = node->Subscribe("~/quadrotor/base_link/quadrotor_bumper/contacts", forcesCb);

  // Listen to ROS for position
  ros::Subscriber sub2 = n.subscribe("ground_truth/state", 1000, positionCb);

  // Busy wait loop...replace with your own code as needed.
  while (true)
    gazebo::common::Time::MSleep(50);

  // Spin ROS (needed for publisher)
  ros::spinOnce();

  // Mayke sure to shut everything down.
  gazebo::shutdown();
}
2015-06-26 08:01:46 -0500 answered a question Gazebo system requirements

I think exact specifications will be hard to find as it all depends on what type of simulation you're running, the version of Gazebo and multiple hardware components. But I think any new laptop (i5 or i7, certainly if you're looking at models with the GTX 860M) should be no problem. Ubuntu runs very very efficiently compared to my normal Windows 7 installation on my Lenovo ultrabook.

Found these threads as well, they have some useful info/guidelines. Maybe check them out to get a general idea: http://answers.gazebosim.org/question/7982/tested-graphic-card-list-for-gazebo/ http://answers.gazebosim.org/question/5559/dual-processors-with-gazebo/ http://answers.gazebosim.org/question/25/run-gazebo-in-virtualbox/

And my experience on Virtual Machine, I tried ROS (no Gazebo yet) on a virtual machine before I installed Ubuntu dualboot and experienced even some lag in typing in the console so I expect any hardcore simulations might run but with very low realtime factor and choppy graphics. Save yourself the hassle (and lag) and just install Ubuntu dualboot.

2015-06-25 06:45:40 -0500 received badge  Famous Question
2015-06-17 04:10:40 -0500 answered a question Help to work on Gazebo 5.0 for a newbie in Simulation

There are a number of threads explaining exactly this. I would recommend only diverting from default package configurations if you are really missing something. Having 2 versions of ROS will probably complicate things if you're just starting to learn.

If you don't need Gazebo5, simply install Indigo which includes Gazebo2 with sudo apt-get install ros-indigo-desktop-full.

If you really need Gazebo5, do the same (install ROS Indigo) and then remove gazebo2 and install gazebo5 and gazebo5 wrappers. Check this thread: http://answers.gazebosim.org/question/8598/how-to-install-ros-indigo-gazebo-ros-control-with/. There's an official page as well but this one doesn't include any step by step manual; it's here: http://answers.gazebosim.org/question/8598/how-to-install-ros-indigo-gazebo-ros-control-with/

As for understanding the beginner tutorials, the step after installation in the tutorials is Getting Started, did you follow that and then continue on to Build a Robot? Maybe you can be more clear on what you don't understand or what you plan to achieve?

2015-06-17 03:57:15 -0500 received badge  Notable Question (source)
2015-06-02 18:12:44 -0500 received badge  Notable Question (source)
2015-06-02 15:49:50 -0500 answered a question VisualPlugin reading contact forces crashes gazebo (black screen)

Here's what worked in the end:

material_plugin3.cpp

2015-06-02 15:49:36 -0500 received badge  Popular Question (source)
2015-06-02 15:49:03 -0500 commented answer VisualPlugin reading contact forces crashes gazebo (black screen)

You are totally right, thanks. Though I don't fully understand how this does work in the standalone subscriber (with a main) and not in this plugin... Anyway, removing it, along with some other changes, did the trick. I'll post the code below for others as reference :).

2015-06-02 04:36:41 -0500 edited question VisualPlugin reading contact forces crashes gazebo (black screen)

Hi,

I'm making my own gazebo plugin to read the contact forces on an object and the change the visual information accordingly. So far, I've been combining:

The plugin I made compiles fine but gives me a black screen when gazebo starts and crashes after about 100 iterations (becomes unresponsive). Verbose mode gives me no errors except a warning after about 30 seconds: "[Wrn] [Publisher.cc:131] Queue limit reached for topic /gazebo/default/pose/local/info, deleting message. This warning is printed only once."

Are there any other ways to figure out exactly why my plugin is crashing? I think it might have something to do with the way I create the subscriber. Here's my code:

material_plugin.h

material_plugin3.cpp