Simulink/ROS: Publishing JointTrajectory Messages for end effector positions
Show older comments
Hi,
I have a human model in Gazebo ROS.The controller is joint trajectory that works fine in ROS environment. Now I have to add a controller but that in Simulink ROS toolbox. Instead of sending Joint Positions I want to send End Effector positions. In other words I am working in Task Space and not in Joint Space. I am unable to access positions from joint trajectory blank message and could not find a solution for quite a while now.
I request if anyone can help me in this regard. I have gone through a question posted in 2017 with title
Simulink/ROS: Publishing JointTrajectory Messages
but it plans in joint space and inputs joint positions. I have to send position commands to my arm group to perform point to point trajectroy planing in Task space(cartesian space). Any help would be appreciated.
Update
As an initial step, I have broken down my problem to first publish one joint position that is to my gripper finger. For this purpose I have used the idea mentioned in the above post highlighted in bold for my gripper joint movement. I do not get any erros in Matlab but I am getting the following error repeatedly in my ROS terminal and hence my joint is not actuated.
Dropping all 1 trajectory point(s), as they occur before the current time. Last point is 0s in the past.
I dont understand why this is happening. Anyhelp would be appreciated please. As if this gets published to the joint and it finally gets actuated, I can eventually take it up further to reach the bigger goal of planning in Cartesian Space.
Thanks
Best
Hasan
Answers (2)
Remo Pillat
on 12 Mar 2021
0 votes
Hi Ehtisham,
Please take a look at the "Control PR2 Arm Movements" example in Robotics System Toolbox. It shows how to create a JointTrajectory message and assign the relevant data (see the rGoalMsg.Trajectory variable in the example). You should be able to extrapolate from that for your own robot, e.g. assign the right joint names.
The example also shows how to use Inverse Kinematics in MATLAB to find the right joint positions for your desired end effector pose.
Once you have it working in MATLAB, you should be able to port this to Simulink pretty easily (there are existing blocks for all the functionality you need).
Hope this help.
7 Comments
Ehtisham ul Hasan
on 12 Mar 2021
Ehtisham ul Hasan
on 14 Mar 2021
Cam Salzberger
on 15 Mar 2021
Hello Hasan,
For R2020a and earlier versions, please see these instructions for updating built-in message types. You'll need the ROS Kinetic message definition packages to do so.
-Cam
Ehtisham ul Hasan
on 15 Mar 2021
Cam Salzberger
on 15 Mar 2021
Well, if MATLAB cannot communicate with an external ROS system for a particular message type, Simulink will certainly have the same issue. So this issue would come up as well.
The specific error message you mentioned indicated you were trying to generate code with a rosactionclient call in it (I assume in a MATLAB Function block). Ensure that your Simulink model is not using Accelerator or Rapid Accelerator mode, as those try to generate code before running, if you need to use actions. Or keep the model just using publishers and subscribers if you need to generate code.
-Cam
Ehtisham ul Hasan
on 16 Mar 2021
Ehtisham ul Hasan
on 16 Mar 2021
Ehtisham ul Hasan
on 18 Mar 2021
0 votes
12 Comments
Cam Salzberger
on 18 Mar 2021
In R2020a, ROS 1 use of rosgenmsg requires the custom message support package installed. See the linked pages from here for some general guidance.
R2020b+ includes rosgenmsg in-product, and does not require a support package. Ensure that you are looking at the documentation for your MATLAB release.
-Cam
Ehtisham ul Hasan
on 19 Mar 2021
Ehtisham ul Hasan
on 19 Mar 2021
Ehtisham ul Hasan
on 19 Mar 2021
Ehtisham ul Hasan
on 19 Mar 2021
Ehtisham ul Hasan
on 24 Mar 2021
charles guo
on 4 May 2021
hi, I come across the same problem. Have you ever gotten a solution?
Ehtisham ul Hasan
on 4 May 2021
charles guo
on 5 May 2021
Thank you for your quick reply. Now, I'm working on ur10 robot , and have tried the method mentioned in "Control PR2 Arm Movements" example , but it didn't work. Would you mind sharing the simulink file as a reference. Thank you again.
charles guo
on 5 May 2021
I also find that action is not supported in simulink as descrbed in ROS Simulink Support and Limitations. There is no action block in ROS Toolbox.
Ehtisham ul Hasan
on 5 May 2021
Edited: Ehtisham ul Hasan
on 5 May 2021
charles guo
on 5 May 2021
Well done! Great appreciation for your help.
Categories
Find more on Publishers and Subscribers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!