Closed xabierolaz closed 3 years ago
This PR, and your commit needs a meaningful title, please review CONTRIBUTING.md.
Your build is also failing, you can click the details to find out why.
Also before opening a PR its important to first be able to verify the code otherwise there's no way for me or another reviewer to verify your code. This may include unit tests, functional tests and/or additional python scripts, that is essentially what the scripts in the /tests directory are used for. Under the PR's Verification Process should include the steps to be able to reproduce the changes to the PR. A test for this would probably look like a stub distance sensor plugin / model (these can be external to GymFC).
I guess a more meaningful questions is, how are you verifying what you posted as a PR works?
This PR, and your commit needs a meaningful title, please review CONTRIBUTING.md.
Your build is also failing, you can click the details to find out why.
Also before opening a PR its important to first be able to verify the code otherwise there's no way for me or another reviewer to verify your code. This may include unit tests, functional tests and/or additional python scripts, that is essentially what the scripts in the /tests directory are used for. Under the PR's Verification Process should include the steps to be able to reproduce the changes to the PR. A test for this would probably look like a stub distance sensor plugin / model (these can be external to GymFC).
I guess a more meaningful questions is, how are you verifying what you posted as a PR works?
Noted, fixing and completing everything now
doesn't look like you ever modified cmakelists.txt
doesn't look like you ever modified cmakelists.txt
sorry, I hadn't pull that one, still throwing same error message though
As cmakelist and distancesensor.proto are fixed now, new errors are thrown, most of them being the sensor not well declared in the flightcontrollerplugin.cpp working on them right now
[ 87%] Building CXX object CMakeFiles/FlightControllerPlugin.dir/FlightControllerPlugin.cpp.o
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp: In member function ‘virtual void gazebo::FlightControllerPlugin::Load(gazebo::physics::WorldPtr, sdf::ElementPtr)’:
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:193:12: error: ‘DISTANCE’ was not declared in this scope
case DISTANCE: //distance sensor
^~~~~~~~
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:193:12: note: suggested alternative: ‘ESTALE’
case DISTANCE: //distance sensor
^~~~~~~~
ESTALE
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:195:15: error: ‘class gazebo::FlightControllerPlugin’ has no member named ‘distanceSub’
this->distanceSub = this->nodeHandle->Subscribe<sensor_msgs::msgs::DistanceSensor>(this->distanceSubTopic, &FlightControllerPlugin::ImuCallback, this);
^~~~~~~~~~~
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:195:98: error: ‘class gazebo::FlightControllerPlugin’ has no member named ‘distanceSubTopic’; did you mean ‘escSubTopic’?
his->nodeHandle->Subscribe<sensor_msgs::msgs::DistanceSensor>(this->distanceSubTopic, &FlightControllerPlugin::ImuCallback, this);
^~~~~~~~~~~~~~~~
escSubTopic
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp: In member function ‘void gazebo::FlightControllerPlugin::InitState()’:
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:290:17: error: ‘class gymfc::msgs::State’ has no member named ‘add_distance’; did you mean ‘add_force’?
this->state.add_distance(0);
^~~~~~~~~~~~
add_force
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp: At global scope:
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:311:53: error: variable or field ‘DistanceSensorCallback’ declared void
void FlightControllerPlugin::DistanceSensorCallback(DistanceSensorPtr &_distanceSensor)
^~~~~~~~~~~~~~~~~
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:311:53: error: ‘DistanceSensorPtr’ was not declared in this scope
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:311:53: note: suggested alternative: ‘ConstSensorPtr’
void FlightControllerPlugin::DistanceSensorCallback(DistanceSensorPtr &_distanceSensor)
^~~~~~~~~~~~~~~~~
ConstSensorPtr
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:311:72: error: ‘_distanceSensor’ was not declared in this scope
d FlightControllerPlugin::DistanceSensorCallback(DistanceSensorPtr &_distanceSensor)
^~~~~~~~~~~~~~~
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp: In member function ‘void gazebo::FlightControllerPlugin::ParseDigitalTwinSDF()’:
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:462:40: error: ‘DISTANCE’ was not declared in this scope
this->supportedSensors.push_back(DISTANCE);
^~~~~~~~
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:462:40: note: suggested alternative: ‘ESTALE’
this->supportedSensors.push_back(DISTANCE);
^~~~~~~~
ESTALE
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp: In member function ‘void gazebo::FlightControllerPlugin::CalculateCallbackCount()’:
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:704:12: error: ‘DISTANCE’ was not declared in this scope
case DISTANCE:
^~~~~~~~
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:704:12: note: suggested alternative: ‘ESTALE’
case DISTANCE:
^~~~~~~~
ESTALE
CMakeFiles/FlightControllerPlugin.dir/build.make:62: recipe for target 'CMakeFiles/FlightControllerPlugin.dir/FlightControllerPlugin.cpp.o' failed
make[2]: *** [CMakeFiles/FlightControllerPlugin.dir/FlightControllerPlugin.cpp.o] Error 1
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/FlightControllerPlugin.dir/all' failed
make[1]: *** [CMakeFiles/FlightControllerPlugin.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
(env) xabi@xabi-VirtualBox:~/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins$
Still getting some building errors with the new distance sensor implementation files published in the PR, any guess @wil3 ?
Thanks
[ 87%] Building CXX object CMakeFiles/FlightControllerPlugin.dir/FlightControllerPlugin.cpp.o
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp: In member function ‘void gazebo::FlightControllerPlugin::InitState()’:
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:290:17: error: ‘class gymfc::msgs::State’ has no member named ‘add_distance’; did you mean ‘add_force’?
this->state.add_distance(0);
^~~~~~~~~~~~
add_force
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp: In member function ‘void gazebo::FlightControllerPlugin::DistanceSensorCallback(gazebo::DistanceSensorPtr&)’:
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:313:34: error: ‘const class sensor_msgs::msgs::DistanceSensor’ has no member named ‘id’
uint32_t id = _distanceSensor->id();
^~
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:317:15: error: ‘class gymfc::msgs::State’ has no member named ‘set_distance’; did you mean ‘set_sim_time’?
this->state.set_distance(id, _distanceSensor->distance_meters());
^~~~~~~~~~~~
set_sim_time
/home/xabi/projects/gymfc-xabi/gymfc/envs/assets/gazebo/plugins/FlightControllerPlugin.cpp:317:49: error: ‘const class sensor_msgs::msgs::DistanceSensor’ has no member named ‘distance_meters’; did you mean ‘distance_’?
this->state.set_distance(id, _distanceSensor->distance_meters());
^~~~~~~~~~~~~~~
distance_
CMakeFiles/FlightControllerPlugin.dir/build.make:62: recipe for target 'CMakeFiles/FlightControllerPlugin.dir/FlightControllerPlugin.cpp.o' failed
make[2]: *** [CMakeFiles/FlightControllerPlugin.dir/FlightControllerPlugin.cpp.o] Error 1
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/FlightControllerPlugin.dir/all' failed
make[1]: *** [CMakeFiles/FlightControllerPlugin.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
All of those errors are in reference to the new entry you added to the State.proto message. The compiler is saying they don't exist so it doesn't appear the source files for the proto are getting compiled with it. Inspect the generated build files in the build directory and confirm its being generated as expected.
Closed as its outdated, newest in #95
Description of the Change
Before we implement a new distance sensor into the aircraft we first have to work on GymFC in order to have those capabilities.
-Distance Sensor Message included in State.proto -Distance Sensor added in FlightControllerPlugin.cpp
Distance Sensor included in State.proto Used IMU as an example in FlightControllerPlugin.cpp to add distance sensor DistanceSensor.proto added
Verification Process
Running build_plugin.sh error