借用apollo3.0的common模块编写自己的控制代码,里面节点还是用的原来就有的Chassis和ControlCommand,但是在编译时遇到了如下问题:
adaptermanager:
REGISTER_ADAPTER(Chassis);
REGISTER_ADAPTER(ControlCommand);
message adapters:
using ChassisAdapter = Adapterapollo::vehicle::Chassis;
using ControlCommandAdapter = Adapterapollo::control::ControlCommand;
[ 31%] Building CXX object driver/modules/driver/SX2306_driver/CMakeFiles/SX2306_driver.dir/__/__/common/adapters/adapter_manager.cc.o
In file included from /opt/ros/noetic/include/ros/serialization.h:37,
from /opt/ros/noetic/include/ros/publisher.h:34,
from /opt/ros/noetic/include/ros/node_handle.h:32,
from /opt/ros/noetic/include/ros/ros.h:45,
from /home/j01058261/driver_test/src/driver/./modules/common/time/time.h:35,
from /home/j01058261/driver_test/src/driver/./modules/common/adapters/adapter.h:39,
from /home/j01058261/driver_test/src/driver/./modules/common/adapters/adapter_manager.h:24,
from /home/j01058261/driver_test/src/driver/modules/common/adapters/adapter_manager.cc:17:
/opt/ros/noetic/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::MD5Sum::value(const M&) [with M = apollo::vehicle::Chassis]’:
/opt/ros/noetic/include/ros/message_traits.h:254:102: required from ‘const char* ros::message_traits::md5sum(const M&) [with M = apollo::vehicle::Chassis]’
/opt/ros/noetic/include/ros/publisher.h:117:38: required from ‘void ros::Publisher::publish(const M&) const [with M = apollo::vehicle::Chassis]’
/home/j01058261/driver_test/src/driver/./modules/common/adapters/adapter_manager.h:246:3: required from here
/opt/ros/noetic/include/ros/message_traits.h:125:14: error: ‘const class apollo::vehicle::Chassis’ has no member named ‘__getMD5Sum’
125 | return m.__getMD5Sum().c_str();
| ~~^~~~~~~~~~~
/opt/ros/noetic/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::DataType::value(const M&) [with M = apollo::vehicle::Chassis]’:
/opt/ros/noetic/include/ros/message_traits.h:263:104: required from ‘const char* ros::message_traits::datatype(const M&) [with M = apollo::vehicle::Chassis]’
/opt/ros/noetic/include/ros/publisher.h:119:11: required from ‘void ros::Publisher::publish(const M&) const [with M = apollo::vehicle::Chassis]’
/home/j01058261/driver_test/src/driver/./modules/common/adapters/adapter_manager.h:246:3: required from here
/opt/ros/noetic/include/ros/message_traits.h:142:14: error: ‘const class apollo::vehicle::Chassis’ has no member named ‘__getDataType’
142 | return m.__getDataType().c_str();
| ~~^~~~~~~~~~~~~
proto是用protoc编译的XX.pb.cc和XX.pb.h,版本3.3.0
个人感觉是proto文件直接通过了ros topic通讯导致的错误,apollo代码理解不充分,不知是哪里疏漏了,请各位指教。