pacmod_ros_msg_handler.h
Go to the documentation of this file.
00001 #ifndef PACMOD_PACMOD_ROS_MSG_HANDLER_H
00002 #define PACMOD_PACMOD_ROS_MSG_HANDLER_H
00003 
00004 /*
00005 * Unpublished Copyright (c) 2009-2017 AutonomouStuff, LLC, All Rights Reserved.
00006 *
00007 * This file is part of the PACMod ROS 1.0 driver which is released under the MIT license.
00008 * See file LICENSE included with this software or go to https://opensource.org/licenses/MIT for full license details.
00009 */
00010 
00011 #include <pacmod_common.h>
00012 
00013 namespace AS
00014 {
00015 namespace Drivers
00016 {
00017 namespace PACMod
00018 {
00019 class LockedData
00020 {
00021 public:
00022   LockedData();
00023 
00024   bool isValid() const;
00025   void setIsValid(bool valid);
00026 
00027   std::vector<unsigned char> getData() const;
00028   void setData(std::vector<unsigned char> new_data);
00029 
00030 private:
00031   std::vector<unsigned char> _data;
00032   bool _is_valid;
00033   mutable std::mutex _data_mut;
00034   mutable std::mutex _valid_mut;
00035 };
00036 
00037 class PacmodTxRosMsgHandler
00038 {
00039 public:
00040   void fillAndPublish(const int64_t& can_id,
00041                       std::string frame_id,
00042                       const ros::Publisher& pub,
00043                       const std::shared_ptr<PacmodTxMsg>& parser_class);
00044 
00045 private:
00046   void fillSystemRptInt(const std::shared_ptr<PacmodTxMsg>& parser_class,
00047                         pacmod_msgs::SystemRptInt* new_msg,
00048                         std::string frame_id);
00049   void fillSystemRptFloat(const std::shared_ptr<PacmodTxMsg>& parser_class,
00050                           pacmod_msgs::SystemRptFloat* new_msg,
00051                           std::string frame_id);
00052   void fillGlobalRpt(const std::shared_ptr<PacmodTxMsg>& parser_class,
00053                      pacmod_msgs::GlobalRpt* new_msg,
00054                      std::string frame_id);
00055   void fillVehicleSpeedRpt(const std::shared_ptr<PacmodTxMsg>& parser_class,
00056                            pacmod_msgs::VehicleSpeedRpt* new_msg,
00057                            std::string frame_id);
00058   void fillMotorRpt1(const std::shared_ptr<PacmodTxMsg>& parser_class,
00059                      pacmod_msgs::MotorRpt1* new_msg,
00060                      std::string frame_id);
00061   void fillMotorRpt2(const std::shared_ptr<PacmodTxMsg>& parser_class,
00062                      pacmod_msgs::MotorRpt2* new_msg,
00063                      std::string frame_id);
00064   void fillMotorRpt3(const std::shared_ptr<PacmodTxMsg>& parser_class,
00065                      pacmod_msgs::MotorRpt3* new_msg,
00066                      std::string frame_id);
00067   void fillWheelSpeedRpt(const std::shared_ptr<PacmodTxMsg>& parser_class,
00068                          pacmod_msgs::WheelSpeedRpt* new_msg,
00069                          std::string frame_id);
00070   void fillSteeringPIDRpt1(const std::shared_ptr<PacmodTxMsg>& parser_class,
00071                            pacmod_msgs::SteeringPIDRpt1* new_msg,
00072                            std::string frame_id);
00073   void fillSteeringPIDRpt2(const std::shared_ptr<PacmodTxMsg>& parser_class,
00074                            pacmod_msgs::SteeringPIDRpt2* new_msg,
00075                            std::string frame_id);
00076   void fillSteeringPIDRpt3(const std::shared_ptr<PacmodTxMsg>& parser_class,
00077                            pacmod_msgs::SteeringPIDRpt3* new_msg,
00078                            std::string frame_id);
00079   void fillParkingBrakeStatusRpt(const std::shared_ptr<PacmodTxMsg>& parser_class,
00080                                  pacmod_msgs::ParkingBrakeStatusRpt* new_msg,
00081                                  std::string frame_id);
00082   void fillYawRateRpt(const std::shared_ptr<PacmodTxMsg>& parser_class,
00083                       pacmod_msgs::YawRateRpt* new_msg,
00084                       std::string frame_id);
00085   void fillLatLonHeadingRpt(const std::shared_ptr<PacmodTxMsg>& parser_class,
00086                             pacmod_msgs::LatLonHeadingRpt* new_msg,
00087                             std::string frame_id);
00088   void fillDateTimeRpt(const std::shared_ptr<PacmodTxMsg>& parser_class,
00089                        pacmod_msgs::DateTimeRpt* new_msg,
00090                        std::string frame_id);
00091   void fillSteeringPIDRpt4(const std::shared_ptr<PacmodTxMsg>& parser_class,
00092                            pacmod_msgs::SteeringPIDRpt4* new_msg,
00093                            std::string frame_id);
00094   void fillVinRpt(const std::shared_ptr<PacmodTxMsg>& parser_class,
00095                   pacmod_msgs::VinRpt* new_msg,
00096                   std::string frame_id);
00097 };
00098 
00099 class PacmodRxRosMsgHandler
00100 {
00101 public:
00102   static std::vector<uint8_t> unpackAndEncode(const int64_t& can_id,
00103                                               const pacmod_msgs::PacmodCmd::ConstPtr& msg);
00104   static std::vector<uint8_t> unpackAndEncode(const int64_t& can_id,
00105                                               const pacmod_msgs::PositionWithSpeed::ConstPtr& msg);
00106 };
00107 }   // namespace PACMod
00108 }   // namespace Drivers
00109 }   // namespace AS
00110 
00111 #endif  // PACMOD_PACMOD_ROS_MSG_HANDLER_H


pacmod
Author(s): Joe Driscoll , Josh Whitley
autogenerated on Sat Jun 8 2019 20:34:19