Contoller in Simulink Matlab 2020b and ROS Melodic

3 views (last 30 days)
I am implementing a motion controller in Simulink for ROS enabled robot. The simulink model sends joint trajectory message to ROS enabled model in Gazebo. I do not get any error in Matlab or anywhere else but the following lines appear whenever I run my code and no motion takes place in Gazebo.
Server: (argc: 5) (argv[0]: /usr/local/MATLAB/R2020b/toolbox/ros/bin/glnxa64/libmwros1server) started (pid: 3438)
Current directory: "/home/has/simulink_models"
*** Done exchange remaining queues terminating
*** Before cleanup the service:
Server: ending (pid: 3438)
Please advice. Help is requested.
Update: I think the issue is time from start is not mentioned in the Matlab Function block and if I use rosduration, it gives an error that rosduration not supported for code generation (in Simulink). So, I need to know what we can do instead of assigning rosduration(1.0) to TimeFromStart in trajectory_messages/JointTrajectoryPoint in Matlab Function Block in Simulink.
NOTE: I also tried assigning rostime, duration, seconds in double and also in integer data type but no success. Though assigning double data type should work as it is the default used by TimeFromStart but it do not work unfortunately.
Thank you for any help or suggestion in this regard.
Ehtisham ul Hasan
Ehtisham ul Hasan on 4 May 2021
Edited: Ehtisham ul Hasan on 4 May 2021
Thank you for the kind response. There was some hard time understanding how TimeFromStart work. What finally worked is though ROS time block is there but updating it or incrementing it in a for loop or while loop did not work. It is just equivalent to ROS simulation time and will keep on running in the backgeound. To ensure the control command is published to Gazebo model and it does not stop at ROS terminal TImeFromStart seconds field in trajectory_msgs/JointTrajectoryPoint message needs to be filled explicitly keeping ROS time block connected as input to the function block.
Thanks for the support.
Best Regards

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!