[关闭]
@Pigmon 2019-07-24T08:30:22.000000Z 字数 723 阅读 27

增加切换状态消息 0724

同力宽体车


底层工程

增加消息:rc_ctrl_switch
msg
CMAKE

  1. Header header
  2. float64 lat_error
  3. float64 lon_error
  4. float64 angle_error
  5. uint8 state
  6. uint8 Normal = 0
  7. uint8 RequiredRC = 1
  8. uint8 Emergency = 2

Translayer

socket_dgram.h

struct DGram_Vehicle

  1. int m_lat_error;
  2. int m_lon_error;
  3. int m_angle_error;

main.cpp

  1. #include <vehicle_msgs/rc_ctrl_switch.h>
  2. ...
  3. void switch_msg_callback(const vehicle_msgs::rc_ctrl_switch &msg);
  4. ...
  5. ros::Subscriber subber_switch = nh.subscribe("rc_switch", 10, switch_msg_callback);
  6. ...
  7. void switch_msg_callback(const vehicle_msgs::rc_ctrl_switch &msg)
  8. {
  9. G::vehicle_dgram.m_lat_error = (int)msg.lat_error * 100;
  10. G::vehicle_dgram.m_lon_error = (int)msg.lon_error * 100;
  11. G::vehicle_dgram.m_angle_error = (int)msg.angle_error * 100;
  12. G::vehicle_dgram.m_ctrl_info = (short)msg.state;
  13. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注