²é¿´: 2607  |  »Ø¸´: 7

szb21971

Òø³æ (ÕýʽдÊÖ)

[ÇóÖú] Ë«×ã»úÆ÷ÈËÐÐ×ß¹÷ͼÔõôÓÃMATLAB»­³öÀ´°¡£¿ÇóÖú°¡£¡£¡£¡ ÒÑÓÐ1È˲ÎÓë

Ë«×ã»úÆ÷ÈËÐÐ×ß¹÷ͼÔõôÓÃMATLAB»­³öÀ´°¡£¿ÇóÖú°¡£¡£¡£¡
»Ø¸´´ËÂ¥

» ²ÂÄãϲ»¶

¹²Ïí¹²Ó®
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

szb21971

Òø³æ (ÕýʽдÊÖ)

ÎÒÒ²¿´µ½Õâ¸öÁË£¬¿ÉÊÇûÓп´¶®£¬Äú»áÕâ¸ö¶«Î÷Âð£¿Ì«×ż±ÁË£¡
¹²Ïí¹²Ó®
2Â¥2015-01-11 11:14:47
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

szb21971

Òø³æ (ÕýʽдÊÖ)

ÎÒÒ²ÕÒµ½Õâ¸öÁË£¬¿ÉÊÇ£¬ÎÒ»¹ÊÇûÓÐŪÃ÷°×£¬±È½Ï׿±¹þ
¹²Ïí¹²Ó®
3Â¥2015-01-11 11:15:36
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

sichanglong

Ìú³æ (СÓÐÃûÆø)

ÊÇÒª»­³ö¹Ø½ÚµÄÁ¬ÏßµÄÁ¬ÐøÔ˶¯Í¼Ã´£¿
ÎÒÓôÃÆÑ½£¬É¶¶¼²»»á£¬»¹ÒªÐ´±¨¸æ¡£¡£¡£¡££º(
4Â¥2015-01-11 16:20:18
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

szb21971

Òø³æ (ÕýʽдÊÖ)

ÒýÓûØÌû:
4Â¥: Originally posted by sichanglong at 2015-01-11 16:20:18
ÊÇÒª»­³ö¹Ø½ÚµÄÁ¬ÏßµÄÁ¬ÐøÔ˶¯Í¼Ã´£¿

àÅ
5Â¥2015-01-12 08:30:41
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

szb21971

Òø³æ (ÕýʽдÊÖ)

ÒýÓûØÌû:
4Â¥: Originally posted by sichanglong at 2015-01-11 16:20:18
ÊÇÒª»­³ö¹Ø½ÚµÄÁ¬ÏßµÄÁ¬ÐøÔ˶¯Í¼Ã´£¿

àŰ¡
¹²Ïí¹²Ó®
6Â¥2015-01-12 08:31:03
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

blackwave

Ìú³æ (³õÈëÎÄ̳)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï
szb21971: ½ð±Ò+10, ¡ïÓаïÖú 2015-01-19 09:46:24
The following is a function I wrote to generate a stick diagram of robot motion. Hope it is helpful to you all.   

function [foot2] = stick(filename,user_frame_per_second,max_step)
global robot
foot2=[];
mov_traj = load(filename);

dt = mov_traj(2,1) - mov_traj(1,1);
frame_per_second = fix(1/dt);
if user_frame_per_second == 0
    show_frame_per_second = frame_per_second;
else
    show_frame_per_second = user_frame_per_second;
end
capture_frame_per_second = 20;
color0 = [0 0 0];
color1 = [0 0 0];
color2 = [0 0 0];
color3 = [1 1 1]*0.5;
color4 = [1 1 1]*0.5;
width = 2;
scrsz = get(0,'ScreenSize');
animation = figure;
%hold on
xxlim = [-0.8 0.8]
yylim = [ 0.0 1.6]
set(animation,'name','2D walking','Position',[100 100 450 450]);
h_axes = axes('Parent',animation,'Units','Pixels','Position',[50 40 400 400],'Ylim',yylim,'Xlim',xxlim);

%tx = text('Parent',h_axes,'Visible','off');
set(h_axes,'visible','on');
ground  = line('Parent',h_axes,'Color',[0 0 0],'Visible','off','LineWidth',2);
set(ground, 'Parent',h_axes,'Xdata',xxlim,'Ydata', [0 0],'visible','on');

idx =1
ss_flag = 0;
step_count = 0;
l_ankle_pos = zeros(2,1); l_knee_pos = zeros(2,1); l_hip_pos  = zeros(2,1); head_pos   = zeros(2,1);
r_knee_pos = zeros(2,1); r_ankle_pos = zeros(2,1);

r_ankle_pos_b_save = [-1,0]';
base = [0 0]';
for i = 1:size(mov_traj,1)
  tt = mov_traj(i,1);
  l_ankle_abs = mov_traj(i,2);
  l_knee_abs  = l_ankle_abs + mov_traj(i,3);
  l_hip_abs   = l_knee_abs + mov_traj(i,4);
  r_hip_abs   = l_hip_abs + mov_traj(i,5);
  r_knee_abs  = r_hip_abs + mov_traj(i,6);
%  r_knee_abs  = r_knee_abs;
  l_ankle_pos_b =[0 0]';
  l_knee_pos_b = [ -robot.calf_length * sin(l_ankle_abs) robot.calf_length* cos(l_ankle_abs)]';
  l_hip_pos_b  = [l_knee_pos_b(1)-sin(l_knee_abs)*robot.thigh_length  l_knee_pos_b(2)+cos(l_knee_abs)*robot.thigh_length ]';
  head_pos_b   = [l_hip_pos_b(1)-sin(l_hip_abs)*robot.torso_length l_hip_pos_b(2) + cos(l_hip_abs)*robot.torso_length]';
  r_knee_pos_b = [l_hip_pos_b(1)+sin(r_hip_abs)*robot.thigh_length l_hip_pos_b(2) - cos(r_hip_abs)*robot.thigh_length]';
  r_ankle_pos_b = [r_knee_pos_b(1)+sin(r_knee_abs)*robot.calf_length r_knee_pos_b(2) - cos(r_knee_abs)*robot.calf_length]';

  if (r_ankle_pos_b_save(1) > 0 && r_ankle_pos_b(1) < 0) % switch
      step_count = step_count +1;
      if step_count >= max_step
          break
      end
      ss_flag = 1;
    tmp = color0; color0 = color4; color4=tmp;
    tmp = color1; color1 = color3; color3=tmp;
    set(l_calf,'Color',color0,'Visible','off');
    set(l_thigh,'Color',color1,'Visible','off');
    set(torso,'Color',color2,'Visible','off')
    set(r_thigh,'Color',color3,'Visible','off');
    set(r_calf,'Color',color4,'Visible','off');
    %     hip_travel = hip_travel + r_ankle_pos_b_save(1);
%     ground_height = ground_height + r_ankle_pos_b_save(2);
    base = base + r_ankle_pos_b_save;
    %ground_height  =0 ;
    %set(h_axes,'Ylim',[-0.05+ground_height 1.95+ground_height]);
    base;
    r_ankle_pos_b_save;
    r_ankle_pos_b;
    %pause   
  end  
  r_ankle_pos_b_save = r_ankle_pos_b;
%  drift = l_hip_pos(1);
%   l_ankle_pos(1) = l_ankle_pos(1) - drift;
%   l_knee_pos(1) = l_knee_pos(1) - drift;
%   l_hip_pos(1)  = l_hip_pos(1) - drift;
%   head_pos(1)   = head_pos(1) - drift;
%   r_knee_pos(1) = r_knee_pos(1) - drift;
%   r_ankle_pos(1) = r_ankle_pos(1) - drift;
  l_ankle_pos = l_ankle_pos_b + base;
  l_knee_pos = l_knee_pos_b  + base;
  l_hip_pos  = l_hip_pos_b  + base;
  head_pos   = head_pos_b  + base;
  r_knee_pos = r_knee_pos_b  + base;
  r_ankle_pos = r_ankle_pos_b  + base;
  
  foot2 = [foot2,r_ankle_pos];


  if (mod(i,fix(frame_per_second/show_frame_per_second)) == 1 )
            torso   = line('Parent',h_axes,'Color',color2,'Visible','off','LineWidth',width);
            r_thigh = line('Parent',h_axes,'Color',color3,'Visible','off','LineWidth',width);
            r_calf  = line('Parent',h_axes,'Color',color4,'Visible','off','LineWidth',width);
            l_calf  = line('Parent',h_axes,'Color',color0,'Visible','off','LineWidth',width);
            l_thigh = line('Parent',h_axes,'Color',color1,'Visible','off','LineWidth',width);
            
            if mod(step_count,2) == 1
                set(l_calf, 'Parent',h_axes,'Xdata',[l_ankle_pos(1) l_knee_pos(1)],'Ydata', [l_ankle_pos(2) l_knee_pos(2)],'visible','on');
                set(l_thigh, 'Parent',h_axes,'Xdata',[l_knee_pos(1) l_hip_pos(1)],'Ydata', [l_knee_pos(2) l_hip_pos(2)],'visible','on');
                set(torso, 'Parent',h_axes,'Xdata',[l_hip_pos(1) head_pos(1)],'Ydata', [l_hip_pos(2) head_pos(2)],'visible','on');
                set(r_thigh, 'Parent',h_axes,'Xdata',[l_hip_pos(1) r_knee_pos(1)],'Ydata', [l_hip_pos(2) r_knee_pos(2)],'visible','on');
                set(r_calf, 'Parent',h_axes,'Xdata',[r_knee_pos(1) r_ankle_pos(1)],'Ydata', [r_knee_pos(2) r_ankle_pos(2)],'visible','on');
            else
                set(torso, 'Parent',h_axes,'Xdata',[l_hip_pos(1) head_pos(1)],'Ydata', [l_hip_pos(2) head_pos(2)],'visible','on');
                set(r_thigh, 'Parent',h_axes,'Xdata',[l_hip_pos(1) r_knee_pos(1)],'Ydata', [l_hip_pos(2) r_knee_pos(2)],'visible','on');
                set(r_calf, 'Parent',h_axes,'Xdata',[r_knee_pos(1) r_ankle_pos(1)],'Ydata', [r_knee_pos(2) r_ankle_pos(2)],'visible','on');
                set(l_calf, 'Parent',h_axes,'Xdata',[l_ankle_pos(1) l_knee_pos(1)],'Ydata', [l_ankle_pos(2) l_knee_pos(2)],'visible','on');
                set(l_thigh, 'Parent',h_axes,'Xdata',[l_knee_pos(1) l_hip_pos(1)],'Ydata', [l_knee_pos(2) l_hip_pos(2)],'visible','on');
               
            end

          stime=sprintf('time:%5.2f',tt);
      %set(tx,'Parent',h_axes,'Position',[l_hip_pos(1),1.8],'String',stime,'visible','on');
      %set(h_axes,'Xlim',[l_hip_pos(1)-1.0 l_hip_pos(1)+1.0]);
      drawnow;
  end
  if l_ankle_pos(1) > xxlim(2)
      break
  end
end
xlabel('(m)')
ylabel('(m)')
7Â¥2015-01-15 11:38:18
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

zbyoyicc

гæ (СÓÐÃûÆø)

ÒýÓûØÌû:
7Â¥: Originally posted by blackwave at 2015-01-15 11:38:18
The following is a function I wrote to generate a stick diagram of robot motion. Hope it is helpful to you all.   

function  = stick(filename,user_frame_per_second,max_step)
global robot
foot2= ...

ËäÈ» ³ÌÐò ¿´²»¶® µ«ÊǸоõ ºÜÄ度µÄѽ
ÉúÃü²»Ï¢£¬·Ü¶·²»Ö¹
8Â¥2015-03-23 14:30:54
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
Ïà¹Ø°æ¿éÌø×ª ÎÒÒª¶©ÔÄÂ¥Ö÷ szb21971 µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] 341Çóµ÷¼Á(Ò»Ö¾Ô¸ºþÄÏ´óѧ070300) +5 ·¬ÇÑÍ·--- 2026-03-22 6/300 2026-03-23 23:45 by Txy@872106
[¿¼ÑÐ] 299Çóµ÷¼Á +5 ijijijijλ 2026-03-21 5/250 2026-03-23 23:36 by ÈÈÇéɳĮ
[¿¼ÑÐ] ¹¤¿Æ0856Çóµ÷¼Á +5 ãåÎö͡͡ 2026-03-21 5/250 2026-03-23 17:56 by º£ÉªÞ±-
[ÂÛÎÄͶ¸å] ¼±·¢ºËÐÄÆÚ¿¯ÂÛÎÄ +3 ÏÍ´ïÎʽò 2026-03-23 5/250 2026-03-23 17:13 by ÃÃ×Ó²»ºÃÈÇ
[¿¼ÑÐ] 291 Çóµ÷¼Á +4 »¯¹¤2026½ì±ÏÒµÉ 2026-03-21 5/250 2026-03-23 16:46 by »¯¹¤2026½ì±ÏÒµÉ
[¿¼ÑÐ] Çóµ÷¼Á²ÄÁÏѧ˶080500£¬×Ü·Ö289·Ö 5+3 @taotao 2026-03-19 21/1050 2026-03-23 10:17 by ¹Úc¸ç
[¿¼ÑÐ] 070300£¬Ò»Ö¾Ô¸±±º½320Çóµ÷¼Á +3 Jerry0216 2026-03-22 5/250 2026-03-23 09:16 by ¡£¡£ÌÃÌÃ
[¿¼ÑÐ] ²ÄÁÏÓ뻯¹¤085600£¬×Ü·Ö304£¬±¾¿ÆÓÐÁ½Æªsci²ÎÓ룬Çóµ÷¼Á +4 ÐÒÔ˵Ľ´½´ 2026-03-22 5/250 2026-03-22 20:15 by edmund7
[¿¼ÑÐ] Çóµ÷¼ÁÒ»Ö¾Ô¸º£´ó£¬0703»¯Ñ§Ñ§Ë¶304·Ö£¬Óдó´´ÏîÄ¿£¬Ëļ¶Òѹý +6 ÐÒÔËÁ¨Á¨ 2026-03-22 10/500 2026-03-22 20:10 by edmund7
[¿¼ÑÐ] 08¹¤¿Æ 320×Ü·Ö Çóµ÷¼Á +11 À滨çóÍí·ç 2026-03-17 11/550 2026-03-22 17:42 by luoyongfeng
[¿¼ÑÐ] 275Çóµ÷¼Á +6 shansx 2026-03-22 8/400 2026-03-22 15:27 by barlinike
[¿¼ÑÐ] 299Çóµ÷¼Á +5 shxchem 2026-03-20 7/350 2026-03-21 17:09 by ColorlessPI
[¿¼ÑÐ] 0805²ÄÁÏ320Çóµ÷¼Á +3 ÉÎïÓï 2026-03-20 3/150 2026-03-21 15:46 by Î޼ʵIJÝÔ­
[¿¼ÑÐ] ²ÄÁÏÓ뻯¹¤£¨0856£©304Çó BÇø µ÷¼Á +3 Çñgl 2026-03-21 3/150 2026-03-21 13:47 by lature00
[¿¼ÑÐ] 307Çóµ÷¼Á +3 wyyyqx 2026-03-17 3/150 2026-03-21 03:20 by JourneyLucky
[¿¼ÑÐ] Ò»Ö¾Ô¸Î人Àí¹¤²ÄÁϹ¤³Ìר˶µ÷¼Á +9 Doleres 2026-03-19 9/450 2026-03-20 22:36 by JourneyLucky
[¿¼ÑÐ] 295²ÄÁÏÇóµ÷¼Á£¬Ò»Ö¾Ô¸Î人Àí¹¤085601ר˶ +5 Charlieyq 2026-03-19 5/250 2026-03-20 20:35 by JourneyLucky
[¿¼²©] É격26Äê +3 °Ë6°Ë68 2026-03-19 3/150 2026-03-19 19:43 by nxgogo
[¿¼ÑÐ] ¡¾Í¬¼ÃÈí¼þ¡¿Èí¼þ£¨085405£©¿¼ÑÐÇóµ÷¼Á +3 2026eternal 2026-03-18 3/150 2026-03-18 19:09 by ²«»÷518
[¿¼ÑÐ] 0703»¯Ñ§µ÷¼Á +3 ÄÝÄÝninicgb 2026-03-17 3/150 2026-03-18 10:29 by macy2011
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û