Gazebo | Ignition | Community
Ask Your Question
0

Basic in environment(world) control.

asked 2016-07-19 03:57:34 -0500

c3mx gravatar image

Hi there ! ,

Do you have any recommended method in order to

create the world that we can interact with it .

such as

  • turn on , off the lights
  • open , close the doors

manually and automatically with the script (py,C++ is alright) .

i have read through the tutorial and i cannot find the way to deal with it directly .

So , i decided to post here to be the reference for the guy who is new to the gazebo like me.

edit retag flag offensive close merge delete

Comments

Actually , I intended to make the simulation of the smart home system. This may help my robot in controlling the smart things inside the home such as turning on , off the lightbulb.

c3mx gravatar imagec3mx ( 2016-07-26 00:56:04 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-07-26 00:53:11 -0500

c3mx gravatar image

This is how I achieve the light control .

Send message by using the STANDALONE PUBLISHER in GAZEBO REPO

and change the message type in the while loop to gazebo::msgs::Light (Need to include light message)

destination of accessing : existing light in .world file => So it has a name.

You can put the name onto the message's name field.

in order to control the light , I used lightMessage set range field . ( 0 = off , others = on )

then you can include ROS Node required file to do the controlling scheme.

edit flag offensive delete link more
0

answered 2016-07-19 09:21:50 -0500

nkoenig gravatar image

You can create one or more plugins to programmatically interact with the world. A model plugin could be used to manually open and close a door, for example.

There are many tutorials on plugins.

edit flag offensive delete link more

Comments

Any suggestion on the light event , such as turn on or turn off the light ? I want to trigger it with C++ Code on the runtime (may be from the ROS-Nodes or QT GUI). I cannot find the exact method to do that, even the plugin creation doesn't make any sense if i want to control that by ROS.

c3mx gravatar imagec3mx ( 2016-07-22 01:54:40 -0500 )edit

The light ( directional , spot ) is not the model, So I cannot directly control it by the plugin.

c3mx gravatar imagec3mx ( 2016-07-22 01:56:36 -0500 )edit

The simplest way to control lights is by publishing light messages to the ~/light/modify topic.

chapulina gravatar imagechapulina ( 2016-07-22 10:09:38 -0500 )edit

@chapulina do you have any example in order to write the C++ or python to publish the messages to ~/light/modify ?

c3mx gravatar imagec3mx ( 2016-07-25 22:43:57 -0500 )edit

@chapulina Update : finally i got the solution :D

c3mx gravatar imagec3mx ( 2016-07-26 00:46:51 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-07-19 03:57:34 -0500

Seen: 1,533 times

Last updated: Jul 26 '16