ros2_canopen icon indicating copy to clipboard operation
ros2_canopen copied to clipboard

How should I use proxy drvier for TPDO?

Open glaciercoder opened this issue 6 months ago • 0 comments

I'm using a servo for robot control and it uses CANOpen for communication. To facilitate the development I use ros2_canopen proxy_driver. The SDO and RPDO works well but PDO doesn't, which means I can receive the data from the servo but I can't control it using ros2_canopen. My bus config is as following:

nodes:
    wheel0_steering:
      node_id: 0x01
      sdo:
        - {index: 0x6081, sub_index: 0, value: 1000} # Rotation Speed
        - {index: 0x6083, sub_index: 0, value: 2000} # Rotation acceleration
        - {index: 0x6060, sub_index: 0, value: 1} # Working mode
        - {index: 0x6040, sub_index: 0, value: 0x0000103f} # enable
      tpdo: # TPDO needed statusword, actual velocity, actual position, mode of operation
        1:
          enabled: true
          cob_id: "auto"
          transmission: 0x01
          mapping:
            - {index: 0x6041, sub_index: 0} # status word
            - {index: 0x6063, sub_index: 0} # position actual value
      rpdo: # RPDO needed controlword, target position, target velocity, mode of operation
        1:
          enabled: true
          cob_id: "auto"
          mapping:
          - {index: 0x607A, sub_index: 0} # target position
          - {index: 0x6040, sub_index: 0} # controlword
          - {index: 0x6060, sub_index: 0} # mode of operation
        2:
          enabled: true
          cob_id: "auto"
          mapping:
          - {index: 0x60FF, sub_index: 0} # target velocity
          - {index: 0x6081, sub_index: 0} # trap velocity

To use proxy driver tpdo, you need to assign index, subindex,data. I wonder what is the correct settings of these. From my knowledge of PDO, I know PDO maps severl objects to one data frame(say target position, control word, mode of operation here), but what is the index and subindex, and how should I set the data?

Besides, I tried to use 0x607A and other members' indices as its index, but nothing happened. I also tried to send three tpdo messages via interface which includes the target position, controlword and mode of operation respectively, still nothing happened and I didn't see any tpdo messages by using candump(but I can see rpdo messages and that works well).

So how should I send tpdo exactly? Please help me.

Thanks a lot!

glaciercoder avatar Aug 23 '24 09:08 glaciercoder