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

Rename map in Motor(node) #1

Open
superlogan72 opened this issue Apr 7, 2023 · 1 comment
Open

Rename map in Motor(node) #1

superlogan72 opened this issue Apr 7, 2023 · 1 comment

Comments

@superlogan72
Copy link

Hello i get this error

motor = Motor(node)
TypeError: init() missing 1 required positional argument: 'rename_map'
can you help me
Thanks
luca

@superlogan72
Copy link
Author

superlogan72 commented Apr 7, 2023

Hello again
i have just add a rename map , but i get this error: motor.move_to_target(TARGET_POSITION)
File "/usr/local/lib/python3.9/dist-packages/motor402-0.1.0-py3.9.egg/motor402/motor.py", line 80, in move_to_target
self.set(target_index, int32(value))
File "/usr/local/lib/python3.9/dist-packages/motor402-0.1.0-py3.9.egg/motor402/motor.py", line 214, in set
index, subindex = self._look_up(variable_index, subindex)
File "/usr/local/lib/python3.9/dist-packages/motor402-0.1.0-py3.9.egg/motor402/motor.py", line 184, in _look_up
return (var.index, var.subindex)
AttributeError: 'NoneType' object has no attribute 'index'
Here us my code:

NODE_ID = 0x01
EDS_PATH = "/home/pi/Desktop/TBS3.eds"
TARGET_POSITION = 200
rename_map = {
"controlword": "Controlword 1",
"statusword": "Statusword 1",
"operating_mode": "Modes of Operation 1",
"target_position": "Target Position 1",
"profile_velocity": "Profile Velocity in pp-mode 1",
"target_velocity": "Target Velocity 1",
"homing_method": "Homing Method 1",
"position_actual_value": "Position Actual Value 1",
"velocity_actual_value": "Velocity Actual Value 1",
"switches": "Switch Parameters 1",
"microstep_resolution": "Microstep Resolution 1"
}

network = canopen.Network()
node = canopen.RemoteNode(NODE_ID, EDS_PATH)
#node = canopen.BaseNode402(1, '/home/pi/Desktop/TBS3.eds')
network.add_node(node)
network.connect(bustype="socketcan", channel="can0")

node.nmt.state = "PRE-OPERATIONAL"

motor = Motor(node,rename_map)

node.nmt.state = "OPERATIONAL"
motor.to_switch_on_disabled()

motor.move_to_target(TARGET_POSITION)

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

1 participant