Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gazebo8 warnings part 10: ifdefs for GetModel, GetEntity, Light (lunar-devel) #657

Merged
merged 5 commits into from
Dec 22, 2017

Conversation

j-rivero
Copy link
Contributor

{ port of pull request #656 }
This adds more ifdefs for functions that let you get pointers to physics objects, like Model, Entity, and Light. The only remaining warnings are from World::GetSimTime and World::GetPhysicsEngine.

~~~
sed -i -e 's@.*->Light(.*@#if GAZEBO_MAJOR_VERSION >= 8\
__REPLACE__&\
\#else\
&\
\#endif@' gazebo_ros/src/gazebo_ros_api_plugin.cpp
~~~

~~~
sed -i -e
  's@^__REPLACE__\(.*\)->Light(\(.*\)@\1->LightByName(\2@' \
  gazebo_ros/src/gazebo_ros_api_plugin.cpp
~~~
First ifdef the GetModel(int) calls with the following:

~~~
sed -i -e 's@.*GetModel(i).*@#if GAZEBO_MAJOR_VERSION >= 8\
__REPLACE__&\
\#else\
&\
\#endif
~~~

~~~
sed -i -e
  's@^__REPLACE__\(.*\)->ModelByIndex(i)\(.*\)@\1->GetModel(i)\2@' \
  gazebo_ros/src/gazebo_ros_api_plugin.cpp
~~~

Then manually move the ifdefs to include for loops.
~~~
sed -i -e 's@.*->GetModel([^i].*@#if GAZEBO_MAJOR_VERSION >= 8\
__REPLACE__&\
\#else\
&\
\#endif@' `grep -rlI 'GetModel(' gazebo_*`
~~~

~~~
sed -i -e
  's@^__REPLACE__\(.*\)->GetModel(\(.*\)@\1->ModelByName(\2@'
  `grep -rlI 'GetModel(' gazebo_*`
~~~

Then manually merge with some ifdefs from LightByName
~~~
sed -i -e 's@.*->GetEntity.*@#if GAZEBO_MAJOR_VERSION >= 8\
__REPLACE__&\
\#else\
&\
\#endif@' `grep -rlI 'GetEntity' gazebo_*`
~~~

~~~
sed -i -e
's@^__REPLACE__\(.*\)->GetEntity(\(.*\)@\1->EntityByName(\2@'
`grep -rlI 'GetEntity(' gazebo_*`
~~~
@j-rivero j-rivero merged commit 35d0544 into lunar-devel Dec 22, 2017
@scpeters scpeters deleted the lunar-devel-transplant-656 branch January 11, 2018 18:01
cohen39 pushed a commit to cohen39/gazebo_ros_pkgs that referenced this pull request Nov 15, 2021
…lunar-devel) (ros-simulation#657)

* gazebo8 warnings: ifdef World::Light(string) calls

~~~
sed -i -e 's@.*->Light(.*@#if GAZEBO_MAJOR_VERSION >= 8\
__REPLACE__&\
\#else\
&\
\#endif@' gazebo_ros/src/gazebo_ros_api_plugin.cpp
~~~

~~~
sed -i -e
  's@^__REPLACE__\(.*\)->Light(\(.*\)@\1->LightByName(\2@' \
  gazebo_ros/src/gazebo_ros_api_plugin.cpp
~~~

* ifdef World::GetModel(int), World::GetModelCount()

First ifdef the GetModel(int) calls with the following:

~~~
sed -i -e 's@.*GetModel(i).*@#if GAZEBO_MAJOR_VERSION >= 8\
__REPLACE__&\
\#else\
&\
\#endif
~~~

~~~
sed -i -e
  's@^__REPLACE__\(.*\)->ModelByIndex(i)\(.*\)@\1->GetModel(i)\2@' \
  gazebo_ros/src/gazebo_ros_api_plugin.cpp
~~~

Then manually move the ifdefs to include for loops.

* ifdef World::GetModel(string)

~~~
sed -i -e 's@.*->GetModel([^i].*@#if GAZEBO_MAJOR_VERSION >= 8\
__REPLACE__&\
\#else\
&\
\#endif@' `grep -rlI 'GetModel(' gazebo_*`
~~~

~~~
sed -i -e
  's@^__REPLACE__\(.*\)->GetModel(\(.*\)@\1->ModelByName(\2@'
  `grep -rlI 'GetModel(' gazebo_*`
~~~

Then manually merge with some ifdefs from LightByName

* ifdef World::GetEntity(string)

~~~
sed -i -e 's@.*->GetEntity.*@#if GAZEBO_MAJOR_VERSION >= 8\
__REPLACE__&\
\#else\
&\
\#endif@' `grep -rlI 'GetEntity' gazebo_*`
~~~

~~~
sed -i -e
's@^__REPLACE__\(.*\)->GetEntity(\(.*\)@\1->EntityByName(\2@'
`grep -rlI 'GetEntity(' gazebo_*`
~~~

* merge some ifdefs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants