Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.nan Position Default Always Sending 0 to Copley NES Drive #158

Open
cgrigas opened this issue Feb 12, 2025 · 2 comments
Open

.nan Position Default Always Sending 0 to Copley NES Drive #158

cgrigas opened this issue Feb 12, 2025 · 2 comments

Comments

@cgrigas
Copy link

cgrigas commented Feb 12, 2025

I'm using a Copley NES drive and trying to operate it in CSP mode. When I try to use the .nan default value however it always sends 0 as the position command. I've confirmed this by querying the 0x607a object with an SDO upload. The drive always rejects this change because it's too large of a step from its real position and it triggers a following error.

If I set a value close to the real current position value in the default then the drive will properly control to that position on startup. Querying the 0x607a object here will give the value that I set in the default. So the drive is properly configured, going to the correct operation state, and the driver is sending the value that I've commanded. The failure seems to be in the .nan feedback interface. A potentially related issue is that I'm also not able to send a command to the position command interface with a ROS2 Control ForwardCommandController, again it's always 0.

I'm successfully using the .nan position feedback with other devices, but there seems to be something in particular wrong with this specific drive combination. I think it may be related to the drive using a TPDO/RPDO in a non standard address range (0x1700 for RPDO and 0x1B00 for TPDO), but that's an unconfirmed suspicion.

I've spent a few days debugging this so any help would be greatly appreciated.

YAML config:

vendor_id: 0x000000AB # Copley Controls vendor ID (171 in hex)
product_id: 0x00002080 # NES drive product code
revision_number: 0x00010003 # From ESI Type RevisionNo
auto_fault_reset: true
auto_enable_set: true


sdo:
  # PDO mapping configuration
  
  - { index: 0x1A00, sub_index: 0, type: uint8, value: 0 }
  - { index: 0x1A01, sub_index: 0, type: uint8, value: 0 }
  - { index: 0x1A02, sub_index: 0, type: uint8, value: 0 }
  - { index: 0x1A03, sub_index: 0, type: uint8, value: 0 }
  - { index: 0x1600, sub_index: 0, type: uint8, value: 0 }
  - { index: 0x1601, sub_index: 0, type: uint8, value: 0 }
  - { index: 0x1602, sub_index: 0, type: uint8, value: 0 }
  - { index: 0x1603, sub_index: 0, type: uint8, value: 0 }

  - { index: 0x1C12, sub_index: 0, type: uint8, value: 0 } # Number of assigned RxPDOs
  - { index: 0x1C12, sub_index: 1, type: uint16, value: 0x1700 }
  - { index: 0x1C12, sub_index: 0, type: uint8, value: 1 } # Number of assigned RxPDOs

  - { index: 0x1C13, sub_index: 0, type: uint8, value: 0 } # Number of assigned TxPDOs
  - { index: 0x1C13, sub_index: 1, type: uint16, value: 0x1B00 } # Assign TxPDO
  - { index: 0x1C13, sub_index: 0, type: uint8, value: 1 } # Number of assigned TxPDOs

  # Operation mode
  - { index: 0x6060, sub_index: 0, type: int8, value: 8 } # CSP Mode

rpdo:
  # POSITION CONTROL PDOS
  - index: 0x1700
    channels:
      - {
          index: 0x6040,
          sub_index: 0,
          type: uint16,
        }
      - {
          index: 0x607a,
          sub_index: 0,
          type: int32,
          command_interface: position,
          default: .nan,
          factor: 1000000,
          offset: 1211580,
        }
      - {
          index: 0x60b1,
          sub_index: 0,
          type: int32,
          factor: 10000000,
          offset: 0,
        }
      - {
          index: 0x60b2,
          sub_index: 0,
          type: int16,
          factor: 89.2857142857,
          offset: 0,
        }
tpdo:
  - index: 0x1B00
    channels:
      - {
          index: 0x6041,
          sub_index: 0,
          type: uint16,
        }
      - {
          index: 0x6064,
          sub_index: 0,
          type: int32,
          state_interface: position,
          factor: 0.000001,
          offset: -1.21158,
        }
      - { index: 0x60f4, sub_index: 0, type: int32, factor: 1.0, offset: 0 }
      - {
          index: 0x606c,
          sub_index: 0,
          type: int32,
          state_interface: velocity,
          factor: 0.000001,
          offset: -1.21158,
        }
      - {
          index: 0x6077,
          sub_index: 0,
          type: int16,
          state_interface: effort,
          factor: 0.0112,
          offset: 0,
        }
@filippo-bosi
Copy link

Hello, I encountered a similar issue. In my case, the root cause was the joint_trajectory_controller.

The problem was that the controller was being spawned too early, causing the position command to default to zero. I resolved this by introducing a delay before spawning the controller, making sure that the system had enough time to initialize properly.

Here’s the code I used in my launch file:

controller_spawner = TimerAction(
    period=controller_spawner_timeout,  # Delay before spawning controllers
    actions=[
        Node(
            package="controller_manager",
            executable="spawner",
            arguments=["joint_trajectory_controller", "-c", "/controller_manager"],
            output="screen",
        )
    ]
)

@cgrigas
Copy link
Author

cgrigas commented Feb 12, 2025

Thanks for the response @filippo-bosi , but in my case it looks like it was a similar issue to this other issue #125 . I didn't have object 0x6061 mode of operation display mapped and that apparently prevents all commands to the target position object. This seems like a pretty important dependency that should be mentioned in the documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants