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

Revision history [back]

click to hide/show revision 1
initial version

Hi,

When you create your gazebo_msgs::GetPhysicsProperties getphysicsproperties object with the default constructor, all values will be initialized to zero (including time_step). In order to get the current properties from Gazebo you have to call the /gazebo/get_physics_properties first with getphysicsproperties as argument.

Hi,

When you create your gazebo_msgs::GetPhysicsProperties getphysicsproperties object with the default constructor, all values will be initialized to zero (including time_step). In order to get the current properties from Gazebo you first have to call the /gazebo/get_physics_properties first service with getphysicsproperties as argument.

Hi,

When you create your gazebo_msgs::GetPhysicsProperties getphysicsproperties object with the default constructor, all values will be initialized to zero (including time_step). In order to get the current properties from Gazebo you first have to call the /gazebo/get_physics_properties service with getphysicsproperties as argument.

Also, in order to get the current model state from Gazebo you have to call the /gazebo/get_model_state service with a gazebo_msgs/GetModelState object as argument.

Hi,

When you create your gazebo_msgs::GetPhysicsProperties getphysicsproperties object with the default constructor, all values will be initialized to zero (including time_step). In order to get the current properties from Gazebo you first have to call the /gazebo/get_physics_properties service with getphysicsproperties as argument.

Also, in order to get the current model state from Gazebo you have to call the /gazebo/get_model_state service with a gazebo_msgs/GetModelState object as argument.

ros::ServiceClient  pp_c = n.serviceClient<gazebo_msgs::GetPhysicsProperties>("/gazebo/get_physics_properties");
pp_c.call(getphysicsproperties);//getphysicsproperties now holds the current properties

//create your desired model state and call the /gazebo/set_model_state service here

gazebo_msgs::GetModelState ms;
ms.request.model_name="my_robot";
ros::ServiceClient gms_c = n.serviceClient<gazebo_msgs::GetModelState>("/gazebo/get_model_state");
gms_c.call(ms);//ms now holds the current state

Hi,

When you create your gazebo_msgs::GetPhysicsProperties getphysicsproperties object with the default constructor, all values will be initialized to zero (including time_step). In order to get the current properties from Gazebo you first have to call the /gazebo/get_physics_properties service with getphysicsproperties as argument.

Also, in order to get the current model state from Gazebo you have to call the /gazebo/get_model_state service with a gazebo_msgs/GetModelState object as argument.argument:

ros::ServiceClient  pp_c = n.serviceClient<gazebo_msgs::GetPhysicsProperties>("/gazebo/get_physics_properties");
pp_c.call(getphysicsproperties);//getphysicsproperties now holds the current properties

//create your desired model state and call the /gazebo/set_model_state service here

gazebo_msgs::GetModelState ms;
ms.request.model_name="my_robot";
gms;
gms.request.model_name="my_robot";
ros::ServiceClient gms_c = n.serviceClient<gazebo_msgs::GetModelState>("/gazebo/get_model_state");
gms_c.call(ms);//ms gms_c.call(gms);//gms now holds the current state