TRC4800/MEC4456 Robotics PC 8: Joint ControlR

部署运行你感兴趣的模型镜像

Java Python Department of Mechanical and Aerospace Engineering

TRC4800/MEC4456 Robotics

PC 8: Joint Control

Objective: To model the dynamics and master the partitioned controller design of robotic systems.

Problem 1. Prove that the torque equation for the mechanism shown in Figure 1 is

where gear ratio

What are the effective inertia and effecting damping terms of the system?

Figure 1: Mechanism for Problem 1.

Problem 2. The torque equation for joint 1 for the manipulator shown in Figure 2 is

where masses are point masses at the end of each link.

Figure 2: A two-link RR manipulator.

Compute the variation (as a percentage of the maximum) of inertia “seen" by joint 1 of the manipulator as it changes confi TRC4800/MEC4456 Robotics PC 8: Joint ControlR guration. Use the numerical values

l1 = l2 = 0:5 m m1 = 4:0 kg            m2 = 2:0 kg

Consider that the robot is direct drive and that the rotor inertia is negligible.

Hint: Find the manipulator's mass matrix.

Repeat the calculation for the case of a geared robot (use η = 20) and a rotor inertia of Im = 0:01 kgm2.

Problem 3. In a system like that shown in Figure 3, find the criteria for KD and KP of a PD controller such that the system is never unstable and never underdamped. Design the PD control to control τ (solve the torque balance equations for τ, rather than τm).

The system possesses an un-modelled resonance due to an end-point stiffness K (on the non motor side, not shown in figure). Any damping terms in the system are negligible. Also, η = R1/R2 >1.

Figure 3: Mechanical model of a DC torque motor connected through gearing to inertial load         

您可能感兴趣的与本文相关的镜像

Yolo-v8.3

Yolo-v8.3

Yolo

YOLO(You Only Look Once)是一种流行的物体检测和图像分割模型,由华盛顿大学的Joseph Redmon 和Ali Farhadi 开发。 YOLO 于2015 年推出,因其高速和高精度而广受欢迎

import socket # 目标服务器配置 SERVER_IP = "192.168.137.128" SERVER_PORT = 2020 # 构造报文(注意保留原始格式中的转义字符) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.137.128:443\r\n" # "Content-Length: 961\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?>' # '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">' # '<s:Header>' # '<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">' # '<wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">' # '<wsse:Username>linzihao</wsse:Username>' # '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">' # 'Qtj7NStEy0jJamBcv7Oi1oU08Yw=' # '</wsse:Password>' # '<wsse:Nonce>Bbly9xla5Dy19zbcdPeWmQ==</wsse:Nonce>' # '<wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">' # '2025-10-30T05:46:37Z' # '</wsu:Created>' # '</wsse:UsernameToken>' # '</Security>' # '</s:Header>' # '<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">' # '<GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/>' # '</s:Body>' # '</s:Envelope>' # ) # 新报文内容(保持原始格式) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.137.128:2020\r\n" # "Content-Type: application/soap+xml; charset=utf-8\r\n" # "Content-Length: 299\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?>' # '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">' # '<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">' # '<GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/>' # '</s:Body>' # '</s:Envelope>' # ) # # 完整的请求报文(包含认证头) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.137.128:2020\r\n" # "Content-Type: application/soap+xml; charset=utf-8\r\n" # "Authorization: Digest username=\"linzihao\",realm=\"TP-Link IP-Camera\",qop=\"auth\",algorithm=\"MD5\",uri=\"/onvif/device_service\",nonce=\"TP-Link IP-Camera:5f2904695f2904a96b523a5a27b254da817bcd066a3da5c9\",nc=00000001,cnonce=\"5114C0217B52D2821F1C47269DE5453E\",opaque=\"64943214654649846565646421\",response=\"3e0f24492be6874cb69e1955868fbbab\"\r\n" # "Content-Length: 299\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>' # ) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.137.128:2020\r\n" # "Content-Type: application/soap+xml; charset=utf-8\r\n" # "Authorization: Digest username=\"linzihao\",realm=\"TP-Link IP-Camera\",qop=\"auth\",algorithm=\"MD5\",uri=\"/onvif/device_service\",nonce=\"TP-Link IP-Camera:06300469063004a9abd05593a8dd46cf654a949e09bcd19d\",nc=00000001,cnonce=\"E1E8051AAE6A37F8E1CC566BFE595431\",opaque=\"64943214654649846565646421\",response=\"d6bfcf48164f931d5cade139ca7db3b6\"\r\n" # "Content-Length: 961\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:Username>linzihao</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">cBbNASgvn13AWzfBYG/McefZH1o=</wsse:Password><wsse:Nonce>VBuDixHPQa5VhxUtRapNzg==</wsse:Nonce><wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2025-10-31T03:46:58Z</wsu:Created></wsse:UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>' # ) http_request = ( "POST /onvif/device_service HTTP/1.1\r\n" "Host: 192.168.1.108:80\r\n" "User-Agent: Happytime onvif client V12.7\r\n" "Content-Type: application/soap+xml; charset=utf-8; action=\"http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime\"\r\n" "Content-Length: 1783\r\n" "Connection: close\r\n" "\r\n" '<?xml version="1.0" encoding="UTF-8"?>' '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" ' 'xmlns:enc="http://www.w3.org/2003/05/soap-encoding" ' 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' 'xmlns:wsa="http://www.w3.org/2005/08/addressing" ' 'xmlns:ds="http://www.w3.org/2000/09/xmldsig#" ' 'xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" ' 'xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" ' 'xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" ' 'xmlns:tt="http://www.onvif.org/ver10/schema" ' 'xmlns:tds="http://www.onvif.org/ver10/device/wsdl" ' 'xmlns:trt="http://www.onvif.org/ver10/media/wsdl" ' 'xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" ' 'xmlns:tev="http://www.onvif.org/ver10/events/wsdl" ' 'xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" ' 'xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" ' 'xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" ' 'xmlns:pt="http://www.onvif.org/ver10/pacs" ' 'xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" ' 'xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" ' 'xmlns:tse="http://www.onvif.org/ver10/search/wsdl" ' 'xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" ' 'xmlns:tac="http://www.onvif.org/ver10/accesscontrol/wsdl" ' 'xmlns:tdc="http://www.onvif.org/ver10/doorcontrol/wsdl" ' 'xmlns:tth="http://www.onvif.org/ver10/thermal/wsdl" ' 'xmlns:tcr="http://www.onvif.org/ver10/credential/wsdl" ' 'xmlns:tar="http://www.onvif.org/ver10/accessrules/wsdl" ' 'xmlns:tsc="http://www.onvif.org/ver10/schedule/wsdl" ' 'xmlns:trv="http://www.onvif.org/ver10/receiver/wsdl" ' 'xmlns:tpv="http://www.onvif.org/ver10/provisioning/wsdl" ' 'xmlns:ter="http://www.onvif.org/ver10/error" >' '<s:Body>' '<tds:GetSystemDateAndTime />' '</s:Body>' '</s:Envelope>' ) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.1.108\r\n" # "Content-Type: application/soap+xml; charset=utf-8\r\n" # "Authorization: Digest username=\"admin\",realm=\"Login to 595f962a6e49d8c157d1dea6218657f2\",qop=\"auth\",algorithm=MD5,uri=\"/onvif/device_service\",nonce=\"b252aWYtZGlnZXN0OjY0NDI1MzAwNDAw\",nc=00000001,cnonce=\"AEE942C585CA9337AA6C932729B168B3\",opaque=\"\",response=\"7641183682761179bf6925bc454c8e0e\"\r\n" # "Content-Length: 299\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>' # ) try: # 创建TCP套接字 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((SERVER_IP, SERVER_PORT)) s.sendall(http_request.encode('utf-8')) print(f"已发送 {len(http_request)} 字节到 {SERVER_IP}:{SERVER_PORT}") # 接收响应(可选) response = s.recv(4096) print(f"收到响应: {response.decode('utf-8')}") except Exception as e: print(f"发送失败: {str(e)}") )——POST /onvif/device_service HTTP/1.1 Host: 192.168.1.108 Content-Type: application/soap+xml; charset=utf-8 Content-Length: 299 <?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>——把这个报文转代码中形式
11-04
以下是基于提供的 ONVIF WSDL 列表生成 `onvif.h` 头文件和 C 代码的完整命令流程: --- ### **1. 生成 `onvif.h` 头文件** 使用 `wsdl2h` 合并所有 WSDL 并生成统一头文件: ```bash wsdl2h -o onvif.h \ -t ./onvif_typemap.dat \ http://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl \ http://www.onvif.org/ver10/media/wsdl/media.wsdl \ http://www.onvif.org/ver10/recording/wsdl/recording.wsdl \ http://www.onvif.org/ver10/replay/wsdl/replay.wsdl \ http://www.onvif.org/ver10/search/wsdl/search.wsdl \ http://www.onvif.org/ver10/events/wsdl/event.wsdl \ http://www.onvif.org/ver20/analytics/wsdl/analytics.wsdl \ http://www.onvif.org/ver20/ptz/wsdl/ptz.wsdl \ http://www.onvif.org/ver20/media/wsdl/media.wsdl \ http://www.onvif.org/ver10/deviceIO/wsdl/deviceio.wsdl ``` #### **关键参数说明** | 参数 | 作用 | |------|------| | `-o onvif.h` | 指定输出头文件名 | | `-t ./onvif_typemap.dat` | 使用类型映射文件(解决命名冲突,见下文) | | WSDL URLs | 所有需要集成的 ONVIF 服务 WSDL | --- ### **2. 创建类型映射文件(可选但推荐)** 新建 `onvif_typemap.dat` 文件,解决命名空间冲突: ```text # ONVIF 类型映射规则 [ "ns1" = "http://www.onvif.org/ver10/device/wsdl", "ns2" = "http://www.onvif.org/ver10/media/wsdl", "ns3" = "http://www.onvif.org/ver10/events/wsdl", # 其他命名空间... ] ``` > 注:如果遇到类型重复定义错误(如 `Multiple definitions of 'Capabilities'`),此文件可显式指定命名空间别名。 --- ### **3. 生成 C 代码** 使用 `soapcpp2` 从 `onvif.h` 生成客户端代码: ```bash soapcpp2 -CL -x -I/usr/share/gsoap/import onvif.h ``` #### **参数说明** | 参数 | 作用 | |------|------| | `-CL` | 生成纯客户端代码 | | `-x` | 不生成示例文件 | | `-I/usr/share/gsoap/import` | 指定 gSOAP 的导入目录(含 `stlvector.h` 等) | | `onvif.h` | 输入头文件 | --- ### **4. 生成的文件列表** 执行后会产生以下关键文件: ``` . ├── onvif.h # 主头文件 ├── soapH.h # 序列化/反序列化头文件 ├── soapStub.h # ONVIF 数据结构定义 ├── soapClient.c # SOAP 客户端逻辑 ├── soapC.c # 类型序列化代码 ├── onvif.nsmap # 命名空间映射表 └── *.wsdl # 缓存的 WSDL/XSD 文件(自动下载) ``` --- ### **5. 编译 ONVIF 客户端** 将生成的代码与 gSOAP 库链接: ```bash gcc -o onvif_client \ soapClient.c soapC.c \ your_app_code.c \ -lgsoap -lgsoapssl # 若需 HTTPS 支持 ``` --- ### **常见问题处理** #### **(1) 网络问题导致 WSDL 下载失败** - **解决方法**:手动下载所有 WSDL 和 XSD 到本地,改用本地路径: ```bash wsdl2h -o onvif.h -d ./wsdl_files/ devicemgmt.wsdl media.wsdl ... ``` #### **(2) 命名空间冲突** - **错误示例**:`Error: Multiple definitions of 'Capabilities'` - **修复方案**:在 `onvif_typemap.dat` 中为冲突类型指定别名: ```text "tds:Capabilities" = "http://www.onvif.org/ver10/device/wsdl" "trt:Capabilities" = "http://www.onvif.org/ver10/media/wsdl" ``` #### **(3) 缺失 XSD 文件** - **错误示例**:`Unable to locate schema file 'common.xsd'` - **解决步骤**: 1. 从 ONVIF 官网下载缺失的 XSD。 2. 放置到 `-d` 指定的目录中(如 `./wsdl_files/`)。 --- ### **6. 完整脚本示例** ```bash #!/bin/bash # 1. 生成头文件 wsdl2h -o onvif.h \ -t ./onvif_typemap.dat \ http://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl \ http://www.onvif.org/ver10/media/wsdl/media.wsdl \ http://www.onvif.org/ver10/recording/wsdl/recording.wsdl \ http://www.onvif.org/ver10/replay/wsdl/replay.wsdl \ http://www.onvif.org/ver10/search/wsdl/search.wsdl \ http://www.onvif.org/ver10/events/wsdl/event.wsdl \ http://www.onvif.org/ver20/analytics/wsdl/analytics.wsdl \ http://www.onvif.org/ver20/ptz/wsdl/ptz.wsdl \ http://www.onvif.org/ver20/media/wsdl/media.wsdl \ http://www.onvif.org/ver10/deviceIO/wsdl/deviceio.wsdl # 2. 生成 C 代码 soapcpp2 -CL -x -I/usr/share/gsoap/import onvif.h # 3. 编译(示例) gcc -o onvif_client soapClient.c soapC.c main.c -lgsoap ``` ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值