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

arzhed's profile - activity

2022-06-26 11:41:25 -0500 received badge  Nice Question (source)
2020-05-11 10:55:45 -0500 received badge  Favorite Question (source)
2020-03-11 03:34:18 -0500 received badge  Favorite Question (source)
2018-01-25 18:00:50 -0500 marked best answer Problems to move the wheels with a PID controller

Hi guys!

I got a robot simulated in Gazebo which i'd like to control easily. I made 3 controllers (thanks to the tutorials) : one to control the head and a controller for each wheel. I should mention that the robot stands on a 3rd wheel (it's just a ball actually), it might cause a problem but if so, I don't know which one.

By setting the effort applied on the wheel joints, it works "ok". It's not perfect (zigzags and slidings) but if the applied effort is not to high, it's ok. So, I tried to add a PID to these controllers. The head controller works just fine with it. But when I did the same with the left wheel, I got some very strange results : the robot starts jumping/flying before landing far away when the wheel comes to the position I asked.

I first thought to change the PID parameters, but the problem remains : the effort applied by the pid_controller_.updatePid(current_pos-desired_pos, dt) function is lower than the one I apply on the wheel "by myself" to make it move without "jumping", but the robot still "jumps" (see the update loop in the .cpp file in the "add a pid" tutorial).

I also tried changing the weight of the wheels and the body in the URDF file , and I set the contact coefficient using the following code :

 <gazebo reference="lefttire">
    <mu1 value="100.0" />
    <mu2 value="100.0" />
    <kp  value="1000000.0" />
    <kd  value="1.0" />
  </gazebo>

("lefttire" is the name of the link)

...vainly

Should I add a PID controller for the wheel speed? Or should I look at this 3rd wheel?

Any help appreciated! Thanks!

UPDATE : "Please, help!"

2016-10-19 16:25:56 -0500 received badge  Good Answer (source)
2015-04-13 22:50:18 -0500 marked best answer Controlling joints in Gazebo

Hi everyone

I am new to ROS and Gazebo and I got problems into using the joint_state_publisher package. I have a robot with multiple non-fixed joints. I created 2 launch files : one to display the robot in rviz, the other to display in Gazebo.

RVIZ :

    <launch>
    <arg name="model" />
    <arg name="gui" default="False" />
    <param name="robot_description" textfile="$(arg model)" />
    <param name="use_gui" value="$(arg gui)"/>
    <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" ></node>
    <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
    <node name="rviz" pkg="rviz" type="rviz" args="-d $(find urdf_tutorial)/urdf.vcg" />
</launch>

Gazebo:

<launch>
<include file="$(find gazebo_worlds)/launch/empty_world.launch"/> 
<arg name="model"/>
<arg name="gui" default="False" />
<param name="robot_description" textfile="$(arg model)" />
<node name="spawn_emox" pkg="gazebo" type="spawn_model" args="-urdf -param robot_description -z 5 -model emox" respawn="false" output="screen"/>
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" >
    <param name="use_gui" value="$(arg gui)"/>
</node>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
</launch>

By setting the "gui" argument to "true", I can control the joints on rviz via the joint_state_publisher, but this doesn't work on Gazebo.

Using rxgraph, I see something like that :

/joint_state_publisher---> /robot_state_publisher ---> /rviz ---> /rosout

/gazebo ---> /joint_state_publisher---> /robot_state_publisher ---> /rosout

Actually, /gazebo publishes a /clock topic to both joint_state_publisher and robot_state_publisher, whereas /rviz subscribes to the /tf topic (as expected).

Does anyone know if gazebo can be set as a /tf subscriber? Or any other solution to control the robot in gazebo? Would the pr2_mechanism stack be adapted?

Sorry about the beginner question and the poor english.

thanks!

2013-11-13 09:55:25 -0500 received badge  Nice Answer (source)
2013-10-08 17:15:30 -0500 received badge  Famous Question (source)
2013-02-01 03:19:44 -0500 received badge  Notable Question (source)
2012-11-13 03:53:40 -0500 commented answer How to make a realtime controller get information

Or you may create your own gazebo plugin if you need to.

2012-11-13 03:28:00 -0500 commented answer How to make a realtime controller get information

I would recommend a more "high level" solution, such as the pr2_controller_manager if needed, or at list a non-realtime controller node that might apply forces in a right way, but i guess it is what you wanna do with your arduino board.

2012-11-13 03:25:03 -0500 commented answer How to make a realtime controller get information

did you take a look at Gazebo wiki? There is the list of all services, topics and most plugins available with gazebo in ros, especially the /apply_joint_effort service. But as far as I know, you can not apply speed or position directly in gazebo (except in gazebo gui) since its a physics simulator

2012-11-13 03:02:05 -0500 commented answer How to make a realtime controller get information

I dont understand what you exactly want to do, just know that I use gazebo and I've never used ROS on Arduino so I'll probably wont be very useful to u. So what is your question exactly? Maybe u should try this tutorial : http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29

2012-11-07 21:08:41 -0500 commented question pr2: writing a realtime joint controller

I see nothing wrong in EDIT 4 after quick overview, although I wonder why there are so many other controllers running... Did you print out the effort applied on the joint? It might be useful to see what is going on in the code itself.

2012-11-07 02:25:38 -0500 answered a question How to make a realtime controller get information

I tried everything and it seems that the only way is to advertise a service. It seems a realtime controller can neither subscribe to a topic nor send a request to another service. It can publish a topic thanks to the realtime_tools package though.

For instance : to get information from gazebo, I made an intermediate node that subscribes to topics published by gazebo and sends service requests to the controller. That's the only I found.

2012-11-07 02:16:56 -0500 commented answer pr2: writing a realtime joint controller

Thx Lorenz. I updated it again since both code lines where not coherent. My advice to ccm was to use a different name for the controller and the plugin to declare it right, especially in that line from the tutorial : PLUGINLIB_DECLARE_CLASS(my_controller_pkg, ..., ...). Check files Lorenz told u to

2012-11-07 02:05:16 -0500 edited answer pr2: writing a realtime joint controller

Hi

The warning tells you to declare "my_controller_pkg/MyControllerPlugin" instead of "MyControllerPlugin" when you set your parameters to the parameter server. So the good command is :

rosparam set my_controller_name/type my_controller_pkg/MyControllerPlugin

I don't know what the problem is in Gazebo, but there might be a conflict due to your controller name. As it is said in the tutorial, if you use a yaml file, it should look like this :

my_controller_name:
    type: my_controller_pkg/MyControllerPlugin
    joint_name: r_shoulder_pan_joint

You may try another controller name.

Hope that helps.

2012-11-05 23:05:50 -0500 received badge  Nice Answer (source)
2012-11-02 00:33:26 -0500 commented question pr2: writing a realtime joint controller

Do you see your controller plugin when you type '$ rosrun pr2_controller_manager pr2_controller_manager list-types' now? Again, be careful not to use the same name for your controller and your plugin

2012-10-31 04:45:26 -0500 received badge  Famous Question (source)
2012-10-29 00:37:30 -0500 commented question pr2: writing a realtime joint controller

Are you sure your controller is running?

2012-10-16 02:20:47 -0500 answered a question Problems to move the wheels with a PID controller
2012-10-15 18:42:53 -0500 received badge  Popular Question (source)
2012-10-15 17:11:04 -0500 received badge  Notable Question (source)
2012-10-15 04:52:56 -0500 edited answer publisher and subscriber in single node

You should not declare your publiser in your callback function : this callback function is called only when data is received on topic 'a', that is why topic 'c' depends on topic 'a'. Store the data you got from topic 'a' into a "global" variable and declare your published topic 'c' into the main. For example :

float64 aux;

void chatterCallback(const& msg)
{
   aux=msg->data;
}

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

ros::init (..);

ros::Subscriber sub = .....(.. , .. , chattercallback);

ros::Publisher d =......;

d.publish(..) ;

}

Update : To your question "how to access data from a topic" (see comments)

For example, if you want to access the x position of your robot spawned in gazebo empty world. You can get that information from the topic /model_state that you can get in gazebo your callback function would look like this :

void chatterCallback(const& msg)
{
   aux=msg->pose[1].position.x;
}

Look at the links above. If you need better understanding, launch a robot in gazebo and run the following

$ rostopic echo /gazebo/model_states
2012-10-15 02:46:25 -0500 marked best answer pr2_controller_interface inheritance

Hi everyone!

Using a differential wheeled robot, I'm trying to clean up my controller programs : I used a controller for each wheel in two different package, whereas they are very very similar ! But now, the left wheel controller inherits from the WheelController class, which inherits from the pr2_controller_interface::Controller class (as in the tutorials).

I built the library for the left wheel controller, and specified the base class was the WheelController class (with PLUGINLIB_DECLARE_CLASS and in the controller_plugins.xml file). I got the following when i try to load the controller after running my robot in gazebo :

Could not load class wheelcontroller/LeftWheelControllerPlugin: According to the loaded plugin descriptions the class wheelcontroller/LeftWheelControllerPlugin with base class type pr2_controller_interface::Controller does not exist.

Is the problem that my controller does not directly inherit from the pr2_controller_interface::Controller class? I tried specifying that class instead of the WheelController class, but it still fails.

Any idea?

UP ! (again)

2012-10-15 02:43:45 -0500 received badge  Commentator
2012-10-15 02:43:45 -0500 commented answer pr2_controller_interface inheritance

I did, but I didnt know what to declare as "base_class" : it should be my WheelController class that inherits from pr2_controller_interface, but it caused errors, so I declared pr2_controller_interface as base class, neither did it work. I'm gonna go with only 1 controler plugin as you said, thanks!

2012-10-15 00:02:52 -0500 edited question How to make a realtime controller get information

Hi guys

So I have a robot simulated in Gazebo that I can control with the realtime controllers I made thanks to the tutorials. I also added a service and a PID controller as in the tutorials (which doesnt work good for every controller, but that's another topic!).

Since I want to have a "smart navigation" with the robot, I tried getting information from the ros topic published by gazebo : ModelStates. It gives you position, orientation, velocity... So I made my controller subscribe to that topic the following way (no need to give the whole code).

#include "leftwheelcontroller/leftwcontrol.h"
#include <pluginlib/class_list_macros.h>
#include <ros/ros.h>
#include <gazebo_msgs/ModelStates.h>
#include <boost/shared_ptr.hpp>

namespace controller_ns {

bool lwControllerClass::init(pr2_mechanism_model::RobotState *robot,  ros::NodeHandle &n)
{}

void lwControllerClass::starting()
{}

void lwControllerClass::update()
{    
   ROS_INFO("lefwcontrol : lWEffort= %f",  lWEffort);
}

void lwControllerClass::stopping()
{}

/// Service call to set effort applied on the wheel
bool lwControllerClass::setEffort(leftwheelcontroller::SetEffort::Request& req,leftwheelcontroller::SetEffort::Response& resp)
{}

void lwControllerClass::chatterCallback(const gazebo_msgs::ModelStates::ConstPtr& msg)
{
    lWEffort=msg->pose[1].position.x;
    ROS_INFO("lwController heard this effort set: %f", lWEffort);
}

} // namespace

int main(int argc, char **argv)
{
  ros::init(argc, argv, "lwController");
  ros::NodeHandle n;

  lw_controller_ns::lwControllerClass *p= new lw_controller_ns::lwControllerClass;
  ros::Subscriber sub = n.subscribe("gazebo/model_states", (uint)1000, &lw_controller_ns::lwControllerClass::chatterCallback,p);

  ros::spin();

  return 0;
}

So the callback output gives me the position of the robot (as it is supposed to do), but the update function loop give me "-0.0". I just guess that such subscription can not be done in real time...?

In a way or another, I'd like to get navigation information. I looked at a few things :

  • Navigation stack / Odometry which I don't know if it works in realtime
  • realtime_tools that seems to enable a controller to publish topics, but not to subscribe...
  • GazeboRosIMU plugin and the following answer, but I tried and it seems it just publishes a topic.
  • It seems there is "getModelState" service from Gazebo that may give information such as the "modelstate" topic, but i dont know how to get it, nor how to send it to my RT controller.

Any answer to these questions, or any suggestion is very welcome!

Update : I may build a non real time controller, but in this case (if RT is a dead-end), what tools should I use? pr2_controller_manager or pr2_mechanism_model are realtime specific, and a solution involving topics subscribed by gazebo might be a bit low-level.

UP