You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am trying to send a negative target velocity via a SDO service call. However, when I attempt to do this, it is not possible as the data may only be sent as an unsigned integer (defined in the COWrite.srv file). The object code to which I am writing to supports negative values in the .eds file so I believe that this should work but is just not supported through the ros2_canopen package.
To Reproduce
Use the /sdo_write service to try and write a negative value to an object which should support negative values. This is the specific call I was writing which gave me an issue: ros2 service call /motor1/sdo_write canopen_interfaces/srv/COWrite "{index: 0x60FF, subindex: 0x0, data: -100}"
Expected behavior
My motor was spinning clockwise, I would have expected the motor to spin counter-clockwise once a negative value was set. I was also expecting to receive a true status once the SDO was received which it never was and thus I never received this status.
Logs
When I had the COWrite.srv data as a uint this is the error output I see:
agoyal1642@agoyal1642-HP-Laptop-14-dq1xxx:~/Documents/Zoe2/zoe2$ ros2 service call /motor1/sdo_write canopen_interfaces/srv/COWrite "{index: 0x60FF, subindex: 0x0, data: -2000}"
requester: making request: canopen_interfaces.srv.COWrite_Request(index=24831, subindex=0, data=-2000)
OverflowError: can't convert negative value to unsigned int
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/ros/iron/bin/ros2", line 33, in <module>
sys.exit(load_entry_point('ros2cli==0.25.6', 'console_scripts', 'ros2')())
File "/opt/ros/iron/lib/python3.10/site-packages/ros2cli/cli.py", line 91, in main
rc = extension.main(parser=parser, args=args)
File "/opt/ros/iron/lib/python3.10/site-packages/ros2service/command/service.py", line 41, in main
return extension.main(args=args)
File "/opt/ros/iron/lib/python3.10/site-packages/ros2service/verb/call.py", line 58, in main
return requester(
File "/opt/ros/iron/lib/python3.10/site-packages/ros2service/verb/call.py", line 102, in requester
future = cli.call_async(request)
File "/opt/ros/iron/lib/python3.10/site-packages/rclpy/client.py", line 119, in call_async
sequence_number = self.__client.send_request(request)
SystemError: <built-in method send_request of PyCapsule object at 0x7b993b04f3f0> returned a result with an exception set
However, when I changed the data to an int32, this was the terminal output I saw and the motor did spin the other way like I wanted it to:
agoyal1642@agoyal1642-HP-Laptop-14-dq1xxx:~/Documents/Zoe2/zoe2$ ros2 service call /motor1/sdo_write canopen_interfaces/srv/COWrite "{index: 0x60FF, subindex: 0x0, data: -2000}"
requester: making request: canopen_interfaces.srv.COWrite_Request(index=24831, subindex=0, data=-2000)
response:
canopen_interfaces.srv.COWrite_Response(success=True)
Setup:
Device: Linux Machine
OS: Ubuntu 22.04.4
ROS-Distro: Iron
Branch/Commit: Iron but this should apply to all
Additional context
When I try and build with changing the .srv file, warnings pop up relating to this change. This will probably require further investigation as to how to approach the issue.
The text was updated successfully, but these errors were encountered:
If you're using the CiA402 driver and want to send signed position or velocity targets, you can use the /motor1/target service which expects a COTargetDouble with a float64 type.
Describe the bug
I am trying to send a negative target velocity via a SDO service call. However, when I attempt to do this, it is not possible as the data may only be sent as an unsigned integer (defined in the COWrite.srv file). The object code to which I am writing to supports negative values in the .eds file so I believe that this should work but is just not supported through the ros2_canopen package.
To Reproduce
Use the /sdo_write service to try and write a negative value to an object which should support negative values. This is the specific call I was writing which gave me an issue:
ros2 service call /motor1/sdo_write canopen_interfaces/srv/COWrite "{index: 0x60FF, subindex: 0x0, data: -100}"
Expected behavior
My motor was spinning clockwise, I would have expected the motor to spin counter-clockwise once a negative value was set. I was also expecting to receive a true status once the SDO was received which it never was and thus I never received this status.
Logs
When I had the COWrite.srv data as a uint this is the error output I see:
However, when I changed the data to an int32, this was the terminal output I saw and the motor did spin the other way like I wanted it to:
Setup:
Additional context
When I try and build with changing the .srv file, warnings pop up relating to this change. This will probably require further investigation as to how to approach the issue.
The text was updated successfully, but these errors were encountered: