Hello and welcome.
In this video, we'll learn how to automatically generate
ros_control controller C++ code from [? Simulink ?] model.
We will deploy the controller to a simulated Franka Emika robot
arm to trace a 3D shape.
Before generating the code, you will
simulate the model to verify the controller behavior.
Define a 3D shape to trace and view the result.
The robot arm will trace the six segments that's
shown here in this 3D code.
Load the Panda robot, [INAUDIBLE]
and view the placement of the 3D shape in the robot task space.
Using inverse kinematics, convert the task-space values
to joint-space.
Open the simulation model at the shape tracing controller model
that you will modify to generate cross-control controller.
Next, simulate the model to get the end-effector position
and joint position data.
You can view the points in space with respect to 3D shape.
As seen in this figure, the points
closely follow the six segments of the code.
Using simulation data for end-effective position
and joint positions, you can view
the robot's motion in 3D space.
This verifies the controller behavior.
Let us go over the stimulation environment setup
in Ubuntu Virtual Machine.
Virtual Machine has all the required software
for simulation.
Start ROS Core.
That will relay discovery and topic
information between other ROS nodes and other ROS
applications.
In a new terminal window, browse to the ROS
workspace where the Franka ROS project is built.
This workspace will be used later
to deploy the controller generated from Simulink.
Know the ROS workspace IP address, username,
and password values.
These will be used later on for code generation.
Now, you are ready to generate that code.
Connect MATLAB to ROS master running on the virtual machine.
Let us examine the controller model from which
you will generate code.
We modified the 3D shape tracing model that you saw before
during simulation.
This will be generally a cross-control controller
that can be used for the robots for welding
and painting, et cetera.
There are three parts to this controller.
Tje sense part receives the joint space data
and joint status.
Compute part calculates final trajectory and joint positions.
And command part sends the position commands
to the robot arm.
Open the ROS Control Settings app to assign the robot
hardware resources.
At the joint names in the joint resource
name column and select interface from the resource type column.
In this controller, we use joint positions,
so the resource type is set to PositionJointInterface
for all the ports.
Apply similar settings to the output portion.
When the parameter is [? set, ?] select the block
parameters to tune.
These will become dynamically configured parameters
of the controller.
Your whole parameter will hold the robot arm,
its current position.
And the multiplier will determine
the speed of tracing by changing the interval
for trajectory generation.
Enable ros_control plugin and save the settings.
The remote device settings for code generation
seal the IP address, username, password,
and Catkin workspace folder values
from Ubuntu Virtual Machine in Simulink.
These values will be used to automatically deploy
the controller to the virtual machine.
We'll unload the controller to Catkin workspace
on the virtual machine.
While the build is going on, you can
observe the progress in the Diagnostic Viewer in Simulink.
You can also see the code generation and compilation
progress here.
After code generation, you can inspect the ROS control package
sources automatically downloaded to the catkin workspace
on the virtual machine.
For example, could you see the autogenerated controller C++
file?
We need to add the Simulink controller configuration
to the Franka Gazebo package.
Add the config file from the Franka Gazebo package.
Add the Simulink controller description
to the Franka Gazebo configuration
and [? seal ?] the file.
In the terminal, build the Catkin workspace
to apply the configuration changes.
Once the build is done, start the simulated Franka Emika
robot [? in Panda. ?] Start the rqt controller manager
and rqt reconfigure applications.
The rqt controller manager application
lists all the available controllers
and allows loading, starting and stopping the controllers.
On the list, load and start sl_shape_tracer controller
generated from Simulink.
t_reconfigure application profile
is user interface for tuning the dynamic reconfigure parameters.
Select the sl_shape_tracer controller,
and you should see two parameters--
Hold_Value and Multiplier_Value.
Value.
The Hold_Value parameter is holding the robot arm
in its current position.
We'll use the hold for the robot arm
and follow the trajectory published [? on Simulink. ?]
Now the controller is running, let us published joint space
data from MATLAB.
Search for the topic in the list,
create publisher, and send the joint path segment data
to the controller.
As soon as the controller receives the data,
you see the robot arm starts tracing the shape.
While the controller is running, you
can change the multiplier value to increase
the shape trace and speed.
You could also send a different joint path segment
data or a different shape altogether.
This concludes the short video on how
to generate real-time ROS control
controllers from Simulink.
Thank you.