Closed Scarabrine closed 6 years ago
Hi, Huck
We took 'trajectory_follower.cpp' in ros_chrono/src as example for solving the building problem above. The main problem is that we use develop branch of Chrono while building the ros_chrono. However, all the cpp demos in ros_chrono are based on Chrono's master branch. Noticeable, master branch haven't been updated for over one year and there are many class different between master and develop branches. To solve this problem, we compared the demos from 'https://github.com/projectchrono/chrono/tree/develop/src/demos/vehicle' in master and develop branches. There are several things we have changed to make ros_chrono build and they are good reminds for the difference of two version Chrono.
Hence, we have fixed the building problem of trajectory_follower.cpp. Now, the only problem left is that we need to fix the JSON file's directory (can compile but has one problem for running). For the rest of files, we only need to repeat above procedure on 'hmmwv_model.cpp' and 'test1.cpp' again. This is only some more repetitive work without anyting new, so I will close this problem.
By the way, where should I upload the new trajectory_follower to github, I remember that is Latest under the main page of our git but I forget the exact position. Sorry for asking you to repeat it.
This issue is moved from commit '_removed roschrono from build' to here. This is just a remind for everyone the possible problem when they want to add the ros_chrono.
Main reason for this issue is possibly that the current version of chrono is different to the version when ros_chrono was created. This cause a lot of class members in current version are missing. The solution is direct forward, we need to find out where is each member in current chrono version.
Below, I show the error code when build ros_chrono.
[ 71%] Building CXX object models/chrono/ros_chrono/CMakeFiles/hmmwv_model.dir/src/hmmwv_model.cpp.o [ 72%] Linking CXX executable /home/mavs/MAVs/ros/devel/lib/ros_base_planner/move_base_goal_client [ 72%] Built target move_base_goal_client Scanning dependencies of target test_1 [ 73%] Building CXX object models/chrono/ros_chrono/CMakeFiles/test_1.dir/src/test_1.cpp.o /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/trajectory_follower.cpp: In function ‘int main(int, char)’: /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/trajectory_follower.cpp:644:13: error: ‘class chrono::vehicle::RigidTerrain’ has no member named ‘SetContactMaterialProperties’ terrain.SetContactMaterialProperties(2e7f, 0.3f); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/trajectory_follower.cpp:645:13: error: ‘class chrono::vehicle::RigidTerrain’ has no member named ‘SetColor’ terrain.SetColor(ChColor(1, 1, 1)); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/trajectory_follower.cpp:647:13: error: ‘class chrono::vehicle::RigidTerrain’ has no member named ‘SetTexture’ terrain.SetTexture(data_path+"terrain/textures/tile4.jpg", 200, 200); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/trajectory_follower.cpp:648:66: error: no matching function for call to ‘chrono::vehicle::RigidTerrain::Initialize(double&, double&, double&)’ terrain.Initialize(terrainHeight, terrainLength, terrainWidth); ^ In file included from /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/trajectory_follower.cpp:46:0: /opt/chrono/chrono_source/chrono/src/chrono_vehicle/terrain/RigidTerrain.h:152:10: note: candidate: void chrono::vehicle::RigidTerrain::Initialize() void Initialize(); ^ /opt/chrono/chrono_source/chrono/src/chrono_vehicle/terrain/RigidTerrain.h:152:10: note: candidate expects 0 arguments, 3 provided /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/trajectory_follower.cpp:651:22: error: no matching function for call to ‘chrono::vehicle::hmmwv::HMMWV_Powertrain::HMMWV_Powertrain()’ HMMWV_Powertrain powertrain; ^ In file included from /opt/chrono/chrono_source/chrono/src/chrono_models/vehicle/hmmwv/HMMWV.h:31:0, from /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/trajectory_follower.cpp:50: /opt/chrono/chrono_source/chrono/src/chrono_models/vehicle/hmmwv/HMMWV_Powertrain.h:37:5: note: candidate: chrono::vehicle::hmmwv::HMMWV_Powertrain::HMMWV_Powertrain(const string&) HMMWV_Powertrain(const std::string& name); ^ /opt/chrono/chrono_source/chrono/src/chrono_models/vehicle/hmmwv/HMMWV_Powertrain.h:37:5: note: candidate expects 1 argument, 0 provided /opt/chrono/chrono_source/chrono/src/chrono_models/vehicle/hmmwv/HMMWV_Powertrain.h:35:21: note: candidate: chrono::vehicle::hmmwv::HMMWV_Powertrain::HMMWV_Powertrain(const chrono::vehicle::hmmwv::HMMWV_Powertrain&) class CH_MODELS_API HMMWV_Powertrain : public ChShaftsPowertrain { ^ /opt/chrono/chrono_source/chrono/src/chrono_models/vehicle/hmmwv/HMMWV_Powertrain.h:35:21: note: candidate expects 1 argument, 0 provided /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/trajectory_follower.cpp:703:37: error: ‘tire_forces’ was not declared in this scope parameters hmmwv_params{terrain,tire_forces,my_hmmwv,realtime_timer,sim_frame,steering_input,throttle_input,braking_input,x_traj_curr,y_traj_curr,x_traj_prev,y_traj_prev,target_speed,render_steps,render_frame}; ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/trajectory_follower.cpp:876:24: error: ‘struct parameters’ has no member named ‘tire_forces’ hmmwv_params.tire_forces[0] = tire_front_left.GetTireForce(); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/trajectory_follower.cpp:877:24: error: ‘struct parameters’ has no member named ‘tire_forces’ hmmwv_params.tire_forces[1] = tire_front_right.GetTireForce(); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/trajectory_follower.cpp:878:24: error: ‘struct parameters’ has no member named ‘tire_forces’ hmmwv_params.tire_forces[2] = tire_rear_left.GetTireForce(); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/trajectory_follower.cpp:879:24: error: ‘struct parameters’ has no member named ‘tire_forces’ hmmwv_params.tire_forces[3] = tire_rear_right.GetTireForce(); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/trajectory_follower.cpp:912:140: error: ‘struct parameters’ has no member named ‘tire_forces’ hmmwv_params.my_hmmwv.Synchronize(time, hmmwv_params.steering_input, hmmwv_params.braking_input, powertrain_torque, hmmwv_params.tire_forces); ^ models/chrono/ros_chrono/CMakeFiles/trajectory_follower.dir/build.make:62: recipe for target 'models/chrono/ros_chrono/CMakeFiles/trajectory_follower.dir/src/trajectory_follower.cpp.o' failed make[2]: ** [models/chrono/ros_chrono/CMakeFiles/trajectory_follower.dir/src/trajectory_follower.cpp.o] Error 1 CMakeFiles/Makefile2:2121: recipe for target 'models/chrono/ros_chrono/CMakeFiles/trajectory_follower.dir/all' failed make[1]: [models/chrono/ros_chrono/CMakeFiles/trajectory_follower.dir/all] Error 2 make[1]: * Waiting for unfinished jobs.... [ 74%] Building CXX object computing/perception/detection/obstacle_detection/CMakeFiles/obstacle_detector_gui.dir/src/displays/circle_visual.cpp.o /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/hmmwv_model.cpp: In function ‘int main(int, char*)’: /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/hmmwv_model.cpp:630:13: error: ‘class chrono::vehicle::RigidTerrain’ has no member named ‘SetContactMaterialProperties’ terrain.SetContactMaterialProperties(2e7f, 0.3f); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/hmmwv_model.cpp:631:13: error: ‘class chrono::vehicle::RigidTerrain’ has no member named ‘SetColor’ terrain.SetColor(ChColor(1, 1, 1)); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/hmmwv_model.cpp:633:13: error: ‘class chrono::vehicle::RigidTerrain’ has no member named ‘SetTexture’ terrain.SetTexture(data_path+"terrain/textures/tile4.jpg", 200, 200); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/hmmwv_model.cpp:634:66: error: no matching function for call to ‘chrono::vehicle::RigidTerrain::Initialize(double&, double&, double&)’ terrain.Initialize(terrainHeight, terrainLength, terrainWidth); ^ In file included from /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/hmmwv_model.cpp:35:0: /opt/chrono/chrono_source/chrono/src/chrono_vehicle/terrain/RigidTerrain.h:152:10: note: candidate: void chrono::vehicle::RigidTerrain::Initialize() void Initialize(); ^ /opt/chrono/chrono_source/chrono/src/chrono_vehicle/terrain/RigidTerrain.h:152:10: note: candidate expects 0 arguments, 3 provided /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/hmmwv_model.cpp:637:22: error: no matching function for call to ‘chrono::vehicle::hmmwv::HMMWV_Powertrain::HMMWV_Powertrain()’ HMMWV_Powertrain powertrain; ^ In file included from /opt/chrono/chrono_source/chrono/src/chrono_models/vehicle/hmmwv/HMMWV.h:31:0, from /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/hmmwv_model.cpp:40: /opt/chrono/chrono_source/chrono/src/chrono_models/vehicle/hmmwv/HMMWV_Powertrain.h:37:5: note: candidate: chrono::vehicle::hmmwv::HMMWV_Powertrain::HMMWV_Powertrain(const string&) HMMWV_Powertrain(const std::string& name); ^ /opt/chrono/chrono_source/chrono/src/chrono_models/vehicle/hmmwv/HMMWV_Powertrain.h:37:5: note: candidate expects 1 argument, 0 provided /opt/chrono/chrono_source/chrono/src/chrono_models/vehicle/hmmwv/HMMWV_Powertrain.h:35:21: note: candidate: chrono::vehicle::hmmwv::HMMWV_Powertrain::HMMWV_Powertrain(const chrono::vehicle::hmmwv::HMMWV_Powertrain&) class CH_MODELS_API HMMWV_Powertrain : public ChShaftsPowertrain { ^ /opt/chrono/chrono_source/chrono/src/chrono_models/vehicle/hmmwv/HMMWV_Powertrain.h:35:21: note: candidate expects 1 argument, 0 provided /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/hmmwv_model.cpp:702:37: error: ‘tire_forces’ was not declared in this scope parameters hmmwv_params{terrain,tire_forces,my_hmmwv,realtime_timer,sim_frame,steering_input,throttle_input,braking_input,ballS,ballT,x_traj_curr,y_traj_curr,x_traj_prev,y_traj_prev,target_speed,render_steps,render_frame}; ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/hmmwv_model.cpp:884:24: error: ‘struct parameters’ has no member named ‘tire_forces’ hmmwv_params.tire_forces[0] = tire_front_left.GetTireForce(); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/hmmwv_model.cpp:885:24: error: ‘struct parameters’ has no member named ‘tire_forces’ hmmwv_params.tire_forces[1] = tire_front_right.GetTireForce(); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/hmmwv_model.cpp:886:24: error: ‘struct parameters’ has no member named ‘tire_forces’ hmmwv_params.tire_forces[2] = tire_rear_left.GetTireForce(); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/hmmwv_model.cpp:887:24: error: ‘struct parameters’ has no member named ‘tire_forces’ hmmwv_params.tire_forces[3] = tire_rear_right.GetTireForce(); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/hmmwv_model.cpp:921:140: error: ‘struct parameters’ has no member named ‘tire_forces’ hmmwv_params.my_hmmwv.Synchronize(time, hmmwv_params.steering_input, hmmwv_params.braking_input, powertrain_torque, hmmwv_params.tire_forces); ^ models/chrono/ros_chrono/CMakeFiles/hmmwv_model.dir/build.make:62: recipe for target 'models/chrono/ros_chrono/CMakeFiles/hmmwv_model.dir/src/hmmwv_model.cpp.o' failed make[2]: [models/chrono/ros_chrono/CMakeFiles/hmmwv_model.dir/src/hmmwv_model.cpp.o] Error 1 CMakeFiles/Makefile2:2182: recipe for target 'models/chrono/ros_chrono/CMakeFiles/hmmwv_model.dir/all' failed make[1]: * [models/chrono/ros_chrono/CMakeFiles/hmmwv_model.dir/all] Error 2 [ 75%] Building CXX object computing/perception/detection/obstacle_detection/CMakeFiles/obstacle_detector_gui.dir/src/displays/segment_visual.cpp.o [ 76%] Building CXX object computing/perception/detection/obstacle_detection/CMakeFiles/obstacle_detector_gui.dir/src/panels/scans_merger_panel.cpp.o /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:82:36: error: ‘FLAT’ is not a member of ‘chrono::vehicle::RigidTerrain’ RigidTerrain::Type terrain_model = RigidTerrain::FLAT; ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp: In function ‘int main(int, char*)’: /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:138:14: error: ‘class chrono::vehicle::hmmwv::HMMWV_Full’ has no member named ‘SetPacejkaParamfile’ my_hmmwv.SetPacejkaParamfile("data/vehicle/hmmwv/tire/HMMWV_pacejka.tir"); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:152:13: error: ‘class chrono::vehicle::RigidTerrain’ has no member named ‘SetContactFrictionCoefficient’ terrain.SetContactFrictionCoefficient(0.9f); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:153:13: error: ‘class chrono::vehicle::RigidTerrain’ has no member named ‘SetContactRestitutionCoefficient’ terrain.SetContactRestitutionCoefficient(0.01f); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:154:13: error: ‘class chrono::vehicle::RigidTerrain’ has no member named ‘SetContactMaterialProperties’ terrain.SetContactMaterialProperties(2e7f, 0.3f); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:155:13: error: ‘class chrono::vehicle::RigidTerrain’ has no member named ‘SetColor’ terrain.SetColor(ChColor(0.8f, 0.8f, 0.5f)); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:156:13: error: ‘class chrono::vehicle::RigidTerrain’ has no member named ‘EnableVisualization’ terrain.EnableVisualization(terrain_vis); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:158:14: error: ‘FLAT’ is not a member of ‘chrono::vehicle::RigidTerrain’ case RigidTerrain::FLAT: ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:159:21: error: ‘class chrono::vehicle::RigidTerrain’ has no member named ‘SetTexture’ terrain.SetTexture(vehicle::GetDataFile("data/vehicle/terrain/textures/tile4.jpg"), 200, 200); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:160:74: error: no matching function for call to ‘chrono::vehicle::RigidTerrain::Initialize(double&, double&, double&)’ terrain.Initialize(terrainHeight, terrainLength, terrainWidth); ^ In file included from /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:29:0: /opt/chrono/chrono_source/chrono/src/chrono_vehicle/terrain/RigidTerrain.h:152:10: note: candidate: void chrono::vehicle::RigidTerrain::Initialize() void Initialize(); ^ /opt/chrono/chrono_source/chrono/src/chrono_vehicle/terrain/RigidTerrain.h:152:10: note: candidate expects 0 arguments, 3 provided /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:163:21: error: ‘class chrono::vehicle::RigidTerrain’ has no member named ‘SetTexture’ terrain.SetTexture(vehicle::GetDataFile("data/vehicle/terrain/textures/grass.jpg"), 16, 16); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:164:125: error: no matching function for call to ‘chrono::vehicle::RigidTerrain::Initialize(std::__cxx11::string, const char [7], int, int, int, int)’ terrain.Initialize(vehicle::GetDataFile("data/vehicle/terrain/height_maps/test64.bmp"), "test64", 128, 128, 0, 4); ^ In file included from /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:29:0: /opt/chrono/chrono_source/chrono/src/chrono_vehicle/terrain/RigidTerrain.h:152:10: note: candidate: void chrono::vehicle::RigidTerrain::Initialize() void Initialize(); ^ /opt/chrono/chrono_source/chrono/src/chrono_vehicle/terrain/RigidTerrain.h:152:10: note: candidate expects 0 arguments, 6 provided /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:167:21: error: ‘class chrono::vehicle::RigidTerrain’ has no member named ‘SetTexture’ terrain.SetTexture(vehicle::GetDataFile("data/vehicle/terrain/textures/grass.jpg"), 100, 100); ^ /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:168:105: error: no matching function for call to ‘chrono::vehicle::RigidTerrain::Initialize(std::__cxx11::string, const char [10])’ terrain.Initialize(vehicle::GetDataFile("data/vehicle/terrain/meshes/test.obj"), "test_mesh"); ^ In file included from /home/mavs/MAVs/ros/src/models/chrono/ros_chrono/src/test_1.cpp:29:0: /opt/chrono/chrono_source/chrono/src/chrono_vehicle/terrain/RigidTerrain.h:152:10: note: candidate: void chrono::vehicle::RigidTerrain::Initialize() void Initialize(); ^ /opt/chrono/chrono_source/chrono/src/chrono_vehicle/terrain/RigidTerrain.h:152:10: note: candidate expects 0 arguments, 2 provided make[2]: [models/chrono/ros_chrono/CMakeFiles/test_1.dir/src/test_1.cpp.o] Error 1 models/chrono/ros_chrono/CMakeFiles/test_1.dir/build.make:62: recipe for target 'models/chrono/ros_chrono/CMakeFiles/test_1.dir/src/test_1.cpp.o' failed CMakeFiles/Makefile2:2245: recipe for target 'models/chrono/ros_chrono/CMakeFiles/test_1.dir/all' failed make[1]: [models/chrono/ros_chrono/CMakeFiles/test_1.dir/all] Error 2 [ 78%] Building CXX object computing/perception/detection/obstacle_detection/CMakeFiles/obstacle_detector_gui.dir/src/panels/obstacle_extractor_panel.cpp.o [ 78%] Building CXX object computing/perception/detection/obstacle_detection/CMakeFiles/obstacle_detector_gui.dir/src/panels/obstacle_tracker_panel.cpp.o [ 79%] Building CXX object computing/perception/detection/obstacle_detection/CMakeFiles/obstacle_detector_gui.dir/src/panels/obstacle_publisher_panel.cpp.o [ 80%] Building CXX object computing/perception/detection/obstacle_detection/CMakeFiles/obstacle_detector_gui.dir/obstacle_detector_gui_automoc.cpp.o [ 81%] Linking CXX shared library /home/mavs/MAVs/ros/devel/lib/libobstacle_detector_gui.so [ 81%] Built target obstacle_detector_gui make: [all] Error 2 Makefile:138: recipe for target 'all' failed Base path: /home/mavs/MAVs/ros Source space: /home/mavs/MAVs/ros/src Build space: /home/mavs/MAVs/ros/build Devel space: /home/mavs/MAVs/ros/devel Install space: /home/mavs/MAVs/ros/install
Running command: "cmake /home/mavs/MAVs/ros/src -DCATKIN_DEVEL_PREFIX=/home/mavs/MAVs/ros/devel -DCMAKE_INSTALL_PREFIX=/home/mavs/MAVs/ros/install -G Unix Makefiles" in "/home/mavs/MAVs/ros/build"
Running command: "make -j4 -l4" in "/home/mavs/MAVs/ros/build"
Invoking "make -j4 -l4" failed