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

Custom messages from CodeSys structs: Error parsing ROS_TIME and ROS_DURATION #10

Open
2b-t opened this issue Mar 17, 2021 · 0 comments

Comments

@2b-t
Copy link

2b-t commented Mar 17, 2021

Hello,
I have been playing around with Robin in CodeSys with an Ubuntu 18.04 runtime system with ROS Melodic for a few days now. Really nice work! A very nice idea indeed to merge the two worlds of ROS and classical PLCs! In particular the generation of custom messages from a CodeSys struct comes in very handy!
In this context I have found a small bug with the ROS_TIME and ROS_DURATION data types that only occurs if one tries to assemble a custom message with them.
If we define a struct

TYPE TestStruct :
STRUCT
	var_time: ROS_TIME;
END_STRUCT
END_TYPE

and then define a program in structured text that simply writes it to ROS such as

PROGRAM ROS_PRG
VAR_INPUT
	struct_to_ros: TestStruct;
END_VAR
VAR
	robin: Robin;
END_VAR
robin();
robin.write('struct_to_ros', struct_to_ros);

and then call the Python start_update.py script then the script will end with an error

Output:
* * * * * * * * * * * * *
* * * Robin Updater * * *
* * * * * * * * * * * * *

Creating SSH key ...

Adding SSH key to agent ...
Identity added: C:\Users\lab\.ssh\robin_key (C:\Users\lab\.ssh\robin_key)

Adding SSH key to target ... Password will be required
[email protected]'s password:
[sudo] password for user: Accessing target through ssh... Ensure ssh service is ON. 
Connecting... 
sa-sha2-512)
warning: agent returned different signature type ssh-rsa (expected rsa-sha2-512)

Generating source code...

Generating new ros package robin_bridge_generated...

Recompiling...
NOTICE: Could not determine the width of the terminal. A default width of 80 will be used. This warning will only be printed once.
_______________________________________________________________________________
Errors << robin_bridge_generated:check /home/user/catkin_ws/logs/robin_bridge_generated/build.check.104.log
CMake Error at /home/user/catkin_ws/build/robin_bridge_generated/cmake/robin_bridge_generated-genmsg.cmake:3 (message):
  Could not find messages which
  '/home/user/catkin_ws/src/robin_bridge_generated/msg/TestStruct.msg'
  depends on.  Did you forget to specify generate_messages(DEPENDENCIES ...)?

  Cannot locate message [time] in package [std_msgs] with paths
  [['/opt/ros/melodic/share/std_msgs/cmake/../msg']]
Call Stack (most recent call first):
  /opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:307 (include)
  CMakeLists.txt:23 (generate_messages)


make: *** [cmake_check_build_system] Error 1
cd /home/user/catkin_ws/build/robin_bridge_generated; catkin build --get-env robin_bridge_generated | catkin env -si  /usr/bin/make cmake_check_build_system; cd -
...............................................................................
Failed << robin_bridge_generated:check           [ Exited with code 2 ]
Traceback (most recent call last):
  File "./updater.py", line 401, in <module>
    Updater().update(catkin_ws=catkin_ws)
  File "./updater.py", line 79, in update
    self._recompile_robin(catkin_ws)
  File "./updater.py", line 296, in _recompile_robin
    raise RuntimeError('Failed to recompile robin_bridge_generated package.')
RuntimeError: Failed to recompile robin_bridge_generated package.

and similarly for the ROS_DURATION data type.


Opening the robin/robin_updater/cfg/types.yml file and changing the ROS names to capital letters

66   ROS_TIME:
67       - Time
68       - Time
69       - std_msgs::Time
70   ROS_DURATION:
71       - Duration
72       - Duration
73       - std_msgs::Duration

(so lines 68 and 71 in capital as well) seems to fix it for me.

@2b-t 2b-t changed the title Error parsing ROS_TIME and ROS_DURATION Custom messages from CodeSys structs: Error parsing ROS_TIME and ROS_DURATION Mar 18, 2021
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