Skip to content

Instantly share code, notes, and snippets.

@jaeoh2
Created February 14, 2019 07:49
Show Gist options
  • Select an option

  • Save jaeoh2/fb14b4b0d32ffc066da18dc0c0809f2d to your computer and use it in GitHub Desktop.

Select an option

Save jaeoh2/fb14b4b0d32ffc066da18dc0c0809f2d to your computer and use it in GitHub Desktop.
CAN bitfield parser for ROS callback
typedef struct CAN_msgTag
{
uint8_t Sig_1 : 8;
uint8_t Sig_2 : 8;
uint8_t Sig_3 : 8;
uint8_t Sig_4 : 8;
uint8_t Sig_5 : 8;
uint8_t Sig_6 : 8;
uint8_t Sig_7 : 8;
uint8_t Sig_8 : 8;
} CAN_msg;
void ROS_callback(const CanFrame::ConstPtr& msg)
{
CAN_msg *ptr;
memcpy(&ptr, &msg->data, 8);
}
@ssyonny
Copy link

ssyonny commented Dec 5, 2022

내말은 비트필드 문이 의미가 없어보인다는거지

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment