mirror of
https://github.com/westonrobot/ugv_sdk
synced 2023-04-08 06:32:14 +08:00
added get protocol version api
This commit is contained in:
@@ -26,11 +26,17 @@ struct can_frame {
|
||||
|
||||
#include "ugv_sdk/details/interface/agilex_message.h"
|
||||
|
||||
struct ParserInterface {
|
||||
enum class ProtocolVersion { AGX_V1, AGX_V2 };
|
||||
|
||||
template <ProtocolVersion VersionNumber = ProtocolVersion::AGX_V2>
|
||||
class ParserInterface {
|
||||
public:
|
||||
virtual ~ParserInterface() = default;
|
||||
|
||||
// CAN support
|
||||
virtual bool DecodeMessage(const struct can_frame *rx_frame,
|
||||
AgxMessage *msg) = 0;
|
||||
virtual void EncodeMessage(const AgxMessage *msg,
|
||||
virtual bool EncodeMessage(const AgxMessage *msg,
|
||||
struct can_frame *tx_frame) = 0;
|
||||
virtual uint8_t CalculateChecksum(uint16_t id, uint8_t *data,
|
||||
uint8_t dlc) = 0;
|
||||
@@ -47,6 +53,8 @@ struct ParserInterface {
|
||||
// throw exception
|
||||
return 0;
|
||||
};
|
||||
|
||||
ProtocolVersion GetProtocolVersion() { return VersionNumber; }
|
||||
};
|
||||
|
||||
#endif /* PASER_INTERFACE_HPP */
|
||||
|
||||
@@ -13,10 +13,9 @@
|
||||
#include <string>
|
||||
|
||||
#include "ugv_sdk/details/interface/agilex_message.h"
|
||||
#include "ugv_sdk/details/interface/parser_interface.hpp"
|
||||
|
||||
namespace westonrobot {
|
||||
enum class ProtocolType { AGX_V1, AGX_V2 };
|
||||
|
||||
class RobotInterface {
|
||||
public:
|
||||
~RobotInterface() = default;
|
||||
@@ -33,12 +32,14 @@ class RobotInterface {
|
||||
};
|
||||
virtual void ResetRobotState() = 0;
|
||||
|
||||
virtual ProtocolVersion GetProtocolVersion() = 0;
|
||||
|
||||
protected:
|
||||
/****** functions not available/valid to all robots ******/
|
||||
// functions to be implemented by class AgilexBase
|
||||
virtual void SetMotionMode(uint8_t mode){};
|
||||
|
||||
// any specific robot will use a specialized version of the two functions
|
||||
// any specific robot will use a specialized version of the two functions
|
||||
virtual void SendMotionCommand(double linear_vel, double angular_vel,
|
||||
double lateral_velocity,
|
||||
double steering_angle){
|
||||
|
||||
@@ -29,7 +29,7 @@ struct ScoutState {
|
||||
};
|
||||
|
||||
struct ScoutInterface {
|
||||
~ScoutInterface() = default;
|
||||
virtual ~ScoutInterface() = default;
|
||||
|
||||
virtual void SetMotionCommand(double linear_vel, double angular_vel) = 0;
|
||||
virtual void SetLightCommand(LightMode f_mode, uint8_t f_value,
|
||||
|
||||
Reference in New Issue
Block a user