Plotting multiple inputs with a Simulated TurtleBot
Show older comments
Hi
I’m working with a Simulated TurtleBot in the Gazebo environment (Get Started with Gazebo and Simulated TurtleBot - MATLAB & Simulink - MathWorks Benelux). I can give commands to this TurtleBot via MATLAB to plot arbitrary trajectories, as shown in Figure ;

I defined a function for each English alphabet in which the output will be the plotted letter. I can call these functions from another script related to the TurtleBot, and it will start to print the desired note, as follows
% function path_A = A
% Start with figure
f = figure();
xlim([1 118])
ylim([1 20])
hold on
grid on
% letter A
x1=[0,5,2.5,7.5,5,7.5,10];
y1=[0,10,5,5,10,5,0];
plot(x1,y1,'r','LineWidth',2);
%path
A=[x1;y1];
A=A.';
path_A=A;
% end
The challenge that I face now, I want to give more than one input;
%Insert a letter:
Usertext = input('Insert a letter:');
it’s important to notice I need to shift the x values of each second letter, third letter, etc., maybe with the following command:
%example
path_O=[1 4;2 3; 3 2;4 1];
path_O = path_O + [2*ones(length(path_O),1),zeros(length(path_O),1)];
To have a meaningful name or word at the end.
- How can I give multiple inputs (in my case, letters representing a list with two columns and multiple rows) with a predefined space between each note?
I do appreciate your consideration,
regards,
Accepted Answer
More Answers (0)
Categories
Find more on Network Connection and Exploration 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!