forked from lyphix/High_Level_Control
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
XI LUO
committed
May 30, 2023
1 parent
c2079f4
commit eac5a14
Showing
10 changed files
with
167 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
%% Clean | ||
clc; | ||
close all; | ||
|
||
%% Robot Dog Network Parameters | ||
% this IP is the vm ip | ||
Robot_Dog_IP = '192.168.123.161'; | ||
Robot_Dog_Port = 1145; | ||
|
||
|
||
%% parameters | ||
run_time = 5; | ||
|
||
x_speed = 1.5; %(0.11,1] | ||
z_speed = 0; | ||
%% Robot Dog Command Initialized | ||
Control_Command = zeros(1,11,'single'); | ||
%velocity walking | ||
% Robot dog command | ||
% Control_Command() | ||
% | ||
% +(11) +(9) -(11) | ||
% | | ||
% +(10) dog -(10) | ||
% | | ||
% -(9) | ||
% | ||
% Motive coordiate frame | ||
% wall wall wall wall wall | ||
% ^ z | ||
% | | ||
% | | ||
% x <----O y(pointing up) | ||
% | ||
% | ||
% wall computer wall | ||
|
||
%% Instantiate client object to run Motive API commands | ||
|
||
% Check list: | ||
% 1.Broadcast Frame Date | ||
% 2.Network Interface: Local Loopback | ||
|
||
% https://optitrack.com/software/natnet-sdk/ | ||
% Create Motive client object | ||
dllPath = fullfile('d:','StDroneControl','NatNetSDK','lib','x64','NatNetML.dll'); | ||
assemblyInfo = NET.addAssembly(dllPath); % Add API function calls | ||
theClient = NatNetML.NatNetClientML(0); | ||
|
||
% Create connection to localhost, data is now being streamed through client object | ||
HostIP = '127.0.0.1'; | ||
theClient.Initialize(HostIP, HostIP); | ||
%% | ||
Dog_ID = 1; % Rigid body ID of the drone from Motive | ||
|
||
Control_Command(1)=12; | ||
|
||
Robot_Dog(Robot_Dog_IP,Robot_Dog_Port,Control_Command); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
function Real_Time_Location_Figure(x,z,yaw,t_x,t_z,arrow_length,r,r_x,r_z) | ||
%REAL_TIME_LOCATION_FIGURE Summary of this function goes here | ||
% Detailed explanation goes here | ||
circle_center =[r_x,r_z]; | ||
circle_radius =r; | ||
circle_theta = linspace(0,2*pi,100); | ||
circle_x=circle_center(1)+circle_radius*cos(circle_theta); | ||
circle_y=circle_center(2)+circle_radius*sin(circle_theta); | ||
|
||
fig = findall(0,'Type','Figure'); | ||
if isempty(fig) | ||
fig = figure(); | ||
end | ||
|
||
ax = axes('Parent',fig); | ||
cla(ax); % Clears the current axes | ||
hold(ax, 'on'); | ||
|
||
plot(ax,circle_x,circle_y,'b-'); | ||
xlabel('X') | ||
ylabel('Z') | ||
|
||
plot(ax,0,0,'.'); | ||
plot(ax,t_x,t_z,'.','Color','r','MarkerSize',20); | ||
|
||
ax.DataAspectRatio=[1 1 1]; | ||
dy=arrow_length*cosd(yaw); | ||
dx=arrow_length*sind(yaw); | ||
quiver(x,z,dx,dy,'r','LineWidth',0.2,'MaxHeadSize',2); | ||
|
||
plot(x,z,'Color','r'); | ||
set(gca,'XDir','reverse'); | ||
xlim(ax,[-3,3]); | ||
ylim(ax,[-2,2]); | ||
|
||
hold(ax, 'off'); | ||
drawnow; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.