turtlebot3 simulation
# Terminal 1 - Launch Gazebo with TurtleBot3
roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch
setenv('ROS_MASTER_URI', 'http://localhost:11311') % or if ROS master is on same machine
setenv('ROS_IP', '100.64.129.99') % your Wi-Fi IP address here
rosinit
under unitree_legged_msgs folder
in matlab: rosgenmsg
>>addpath('/home/bijen/bijen_ws/src/matlab_msg_gen_ros1/glnxa64/install/m')
savepath
>> clear classes
rehash toolboxcache
>>rosmsg list
% 1. Connect to ROS (assuming roscore is running and Gazebo is started)
rosinit('http://:11311') % Replace with actual ROS master IP
% 2. Create publisher
pub = rospublisher('/fourbar_description/j1_lf_controller/command', 'unitree_legged_msgs/MotorCmd');
% 3. Create message
msg = rosmessage(pub);
% 4. Set fields
msg.Mode = int32(10);
msg.Q = 0.0;
msg.Dq = 0.0;
msg.Tau = 0.0;
msg.Kp = 0.0;
msg.Kd = 0.0;
msg.Reserve = int32([0 0 0]);
% 5. Publish
send(pub, msg);
Add a MATLAB Prefs Setting (Safe Method)
From a working MATLAB session (even if launched via terminal), type:
opengl('save','software') // to avoid error while opening simulink
//for odom readings
Comments
Post a Comment