Linux (CharDev) PCANBasic: Same ID received on all Channels
Posted: Fri 29. Mar 2024, 20:09
Hello the team, please a small help
- Working on ubuntu 20.04 RT,
- Peak CANFD M2 4 ports
- I have 12 ID's, 3 by CANFD port.
Need to query each ID, be certan to receive anything, and free queue after each end port query.
The position return is the same for all ID's on one port ?!
What did I miss ?
- Working on ubuntu 20.04 RT,
- Peak CANFD M2 4 ports
- I have 12 ID's, 3 by CANFD port.
Need to query each ID, be certan to receive anything, and free queue after each end port query.
Code: Select all
bool read_moteus_RX_queue(int id, int port, float& position) {
moteus_rx_msg.ID = 0x8000 | id;
do
{
Status = CAN_ReadFD(port, &moteus_rx_msg, NULL);
ros::Duration(0.000200).sleep();
}
while(!(Status ==PCAN_ERROR_QRCVEMPTY) && Status == PCAN_ERROR_OK);
memcpy(&_position, &moteus_rx_msg.DATA[MSGRX_ADDR_POSITION], sizeof(float));
position = _position;
return true;
}
What did I miss ?