MATLAB Answers

Simulink/ROS Publishing pose of a 7 DOF arm using moveit_msg​s/MoveGrou​pActionGoa​l

4 views (last 30 days)
Ehtisham ul Hasan
Ehtisham ul Hasan on 25 Mar 2021
Answered: Josh Chen on 29 Jul 2021
Hi,
Not being able to update ROs messages in ROS kinetic and Matlab 2020a. I have now moved to ROS Melodic and Matlab 2020b. I have a ROS based model and I control it using Moveit. Now I want to use the ROS toolbox and publish to moveit_msgs in ROS.
I have the following ros actions available
/execute_trajectory
/mhuman/arm_controller/follow_joint_trajectory
/mhuman/gripper_controller/follow_joint_trajectory
/move_group
/pickup
/place
I selected /move_group which has message type as moveit_msgs/MoveGroupActionGoal but I get errors such as
When I assign group name in matlab function block
msg.Goal.Request.GroupName='right_arm';
Error is
This assignment writes a 'char' value into a 'uint8' type. Code generation does not support changing types through assignment. Check preceding assignments or input type specifications for type mismatches.
When I try to fill in the other fields for position and orientation
msg.Goal.Request.StartState.MultiDOfJointState.Transforms.Translation.X=0.30; (do the same for translation Y and Z and also for rotation which is in X,Y,Z,W)
Error is
This structure does not have a field 'MultiDOfJointState'; new fields cannot be added when structure has been read or used.
I request MathWorks Team to please help me in this regard.
Best
Hasan

Answers (1)

Josh Chen
Josh Chen on 29 Jul 2021
Hello Hasan,
In Simulink, each string is represented as an array of uint8 values. As so, when assigning string fields in a message, you need to cast it to uint8 first. You may refer to the "Work with String Arrays" section on this page as an example.
As for the second error, could you please confirm that the spelling is correct? Is it "MultiDOfJointState" or "MultiDOFJointState"? If certain field does not exist in the message, it cannot be added there.
Hope this helps.
Josh

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!