已解决。重装了Ubuntu18.04系统后,一键安装可以正常运行,没有报错。可能是以前的系统中安装了anaconda,创建了虚拟环境、更改了默认python版本等的原因,未确定根本原因。
鱼哥,建图不成功,车不动,雷达到处飞。是什么原因雷达的坐标到处飞?
【rviz2-5】 【ERROR】 【1740654185.856528800】 【rviz2】: Lookup would require extrapolation into the future. Requested time 1740654185.857362 but the latest data is at time 1740654185.857362, when looking up transform from frame 【laser_frame】 to frame 【map】车子没动雷达坐标乱动.JPG 车子没动雷达坐标乱动2.JPG 车子没动雷达坐标乱动3.JPG
在WSL下安装的Ubuntu 22.04,然后执行的一键安装指令,之后一路畅通,选择桌面版后安装过程中就突然蓝屏了。13a3acc9-7dbd-4b5e-8b3e-98359bab6bf3-image.png
20250227-101014.jpg
本文介绍轻擎2机械臂中实现控制末端刚度+阻尼的方法。
项目地址: https://gitee.com/qingqing-gaq/light_lift_arm_3dof.git
演示视频:【【开源】轻擎2;仿真不了一点,真男人就得上实物!!!】 https://www.bilibili.com/video/BV1RVPveRE1d/?share_source=copy_web&vd_source=54c454ce8d52dd206aad5a0bba0e3c2c
c++上位机中的模式的配置代码:
// AutoServo, //电机内部mit // ManualServo, //手动通过纯力矩控制电机 // Impdence, //阻抗 // Admittance, //导纳 // Gravity, //重力补偿 // JointAutoServo, //关节自动控制,注意要初始化关节位置 // Zero //设置零点 // Teach //示教 control_mode.modeTransition(State::Impdence); 首先说明我们要实现什么效果刚度:物体的的软硬程度,弹簧就是这个词的最好例子。
阻尼:就是“丝滑”的程度,速度越大阻力越大,生活中有些门就有这个效果,为了防止“摔门”的情况,就加了个阻尼器。
惯性:这个好理解,大家也经常能体会到,她和加速度有关。但是在机械臂里(仅针对轻擎哈)就不太好实现,无论是加速度还是惯量都不太好获取。
所以源代码中所谓的“阻抗”仅仅是刚度阻尼控制,且是静态的。
最终效果就是让机械臂交互起来有“弹簧”和“阻尼器”的效果。还要注意的一点,这个方法不考虑环境的刚度,可以说是一个“开环”的力控制。
1、有一个末端期望轨迹(或者一个点,这样效果更好些),和轨迹的速度。期望的刚度和阻尼。
2、正运动学实时计算末端的位置(三轴机械臂,只有位置),通过雅可比矩阵计算末端速度。
3、通过“期望-实际”的方法,计算实际的末端位置和期望的末端位置误差,以及速度误差。
4、有了误差就可以通过
计算末端在有交互的情况下应该向外界产生多少力。
5、通过雅可比矩阵的把末端力映射到关节上,然后输入电机。
1、
代码中的期望轨迹
刚度40,阻尼8
arm.end_impedance_control(arm.desir_end_efect_pos, arm.desir_end_efect_vel, arm.current_joint_pos, arm.current_joint_vel, arm.joint_impedance_tau, 8.0, 40, end_force);阻抗函数中的内容:
先计算雅可比矩阵:
2、
正运动学实时计算末端的位置和速度:
3、
末端位置误差,以及速度误差
4、
计算末端在有交互的情况下应该向外界产生多少力
5、
通过雅可比矩阵的把末端力映射到关节上
因为是mit模式,所以如果想要只输入力矩,就需要把kpkd设置为0;
motor.kp[0] = 0; motor.kd[0] = 0.0; motor.kp[1] = 0; motor.kd[1] = 0.0; motor.kp[2] = 0; motor.kd[2] = 0.0; motor.ControlMotors_g(port, motor.desir_motor_pos, motor.desir_motor_vel, motor.kp, motor.kd, motor.motor_control_tau,//前面计算的各个关节的力矩 arm.desir_grp); 还有一些小细节因为机械臂有重量,所以输入各个关节的力矩如果单纯是阻抗力的话,效果可能不太好,所以还需要加上重力补偿的力:
// 关节的控制力矩 = 重力补偿力矩 + 阻尼力矩 arm.joint_control_tau[0] = arm.joint_gravity_tau[0] + 1.0 * arm.joint_impedance_tau[0]; arm.joint_control_tau[1] = arm.joint_gravity_tau[1] + 1.0 * arm.joint_impedance_tau[1]; arm.joint_control_tau[2] = arm.joint_gravity_tau[2] + 1.0 * arm.joint_impedance_tau[2];通过手动修改各个轴上的力可以实现不同轴的力效果,比如一个常值,或者0:
Fx = 2*c * de[0] + 9*k * e[0]; //x轴 Fy = 2*c * de[1] + 9*k * e[1]; //y轴 Fz = 1; //z轴 实话实说算法很简单,效果也挺好(个人感觉)。
但是毕竟是电流环,也没力矩传感器,这个输出的力精度是没保证的,程序上输出1n,实际可能大点或小点。
当然也可以做电机的标定,机械臂的摩擦辨识。我嫌麻烦就没深入搞。
不同的轴向力的输出效果也略不同,这个可能跟摩擦和重力有关。
我想在虚拟机Ubuntu18.04上安装ROS1,使用小鱼一键安装指令
wget http://fishros.com/install -O fishros && . fishros后,依次输入[1](一键安装ROS)、[1](更换系统源再继续安装)、[2](更换系统远并清理第三方源),随后一直换源失败。
后续该换源过程一直反复。请问各位应该怎么解决,非常感谢!
fca86c0363662a7541fef51e3d30219c.png
在b站跟随视频教程学习自定义通讯接口(【《ROS 2机器人开发从入门到实践》3.4.2自定义通信接口】 https://www.bilibili.com/video/BV1dTHgeeEPm/?share_source=copy_web&vd_source=1c2eea6feeef8f20a13d97bff76c2fa6)
遇到构建失败问题(报错如下),提示未找到依赖资源,但经查证依赖包已下载且无拼写错误(第二段)。网上并未找到类似情况,求大神指点
lens@lens-virtual-machine:~/work/capt3/topic_practice_ws$ colcon build
[0.235s] WARNING:colcon.colcon_core.package_identification:Failed to parse ROS package manifest in 'src/status_interfaces': Error(s) in package 'src/status_interfaces/package.xml':
Error(s):
The manifest of package "status_interfaces" (with format version 3) must not contain the following tags: menber_of_group
Starting >>> status_interfaces
--- stderr: status_interfaces
CMake Error at CMakeLists.txt:11 (find_package):
By not providing "Findrosidl_default_genterators.cmake" in
CMAKE_MODULE_PATH this project has asked CMake to find a package
configuration file provided by "rosidl_default_genterators", but CMake did
not find one.
Could not find a package configuration file provided by
"rosidl_default_genterators" with any of the following names:
rosidl_default_genteratorsConfig.cmake
rosidl_default_genterators-config.cmake
Add the installation prefix of "rosidl_default_genterators" to
CMAKE_PREFIX_PATH or set "rosidl_default_genterators_DIR" to a directory
containing one of the above files. If "rosidl_default_genterators"
provides a separate development package or SDK, be sure it has been
installed.
——————————————————————————————
查找依赖
lens@lens-virtual-machine:~/work/capt3/topic_practice_ws$ find /opt/ros -name "rosidl_default_generatorsConfig.cmake"
/opt/ros/humble/share/rosidl_default_generators/cmake/rosidl_default_generatorsConfig.cmake
——————————————————————————————
CMakeLists.txt文件内容
cmake_minimum_required(VERSION 3.8)
project(status_interfaces)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
find_package(ament_cmake REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(rosidl_default_genterators REQUIRED)
rosidl_genterate_interfaces(${PROJECT_NAME}
"msg/SystemStatus.msg"
DEPENDENCIES builtin_interfaces
)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(ament_cmake_copyright_FOUND TRUE)
the following line skips cpplint (only works in a git repo) comment the line when this package is in a git repo and when a copyright and license is added to all source filesset(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()
——————————————————————————————
文件结构
93782442-3416-4453-a45b-3b68e848feab-图片.png
[Err] [RTShaderSystem.cc:480] Unable to find shader lib. Shader generating will fail. Your GAZEBO_RESOURCE_PATH is probably improperly set. Have you sourced <prefix>/share/gazebo/setup.bash?
[spawn_entity.py-4] [INFO] [1740479071.797195348] [spawn_entity]: Calling service /spawn_entity
[gzserver-2] [Msg] Loading world file [/home/jzx/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_description/world/custom_room.world]
[gzserver-2] [Err] [RenderEngine.cc:197] Failed to initialize scene
[gzserver-2] gzserver: /usr/include/boost/smart_ptr/shared_ptr.hpp:728: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = gazebo::rendering::Scene; typename boost::detail::sp_member_access<T>::type = gazebo::rendering::Scene*]: Assertion `px != 0' failed.
[gzclient-3] [Msg] Waiting for master.
[gzclient-3] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
[gzclient-3] [Msg] Publicized address: 172.17.131.16
[gzclient-3] [Err] [RTShaderSystem.cc:480] Unable to find shader lib. Shader generating will fail. Your GAZEBO_RESOURCE_PATH is probably improperly set. Have you sourced <prefix>/share/gazebo/setup.bash?
[ERROR] [gzserver-2]: process has died [pid 6037, exit code -6, cmd 'gzserver /home/jzx/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_description/world/custom_room.world --verbose -slibgazebo_ros_init.so -slibgazebo_ros_factory.so -slibgazebo_ros_force_system.so'].
[gzserver-2]
[gzclient-3] [Err] [Scene.cc:227] Service call[/shadow_caster_material_name] timed out
[gzclient-3] [Err] [Scene.cc:249] Service call[/shadow_caster_render_back_faces] timed out
[gzclient-3] [Err] [RenderEngine.cc:197] Failed to initialize scene
[gzclient-3] [Err] [GLWidget.cc:177] GLWidget could not create a scene. This will likely result in a blank screen.
[gzclient-3] gzclient: /usr/include/boost/smart_ptr/shared_ptr.hpp:728: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = gazebo::rendering::Camera; typename boost::detail::sp_member_access<T>::type = gazebo::rendering::Camera*]: 断言 "px != 0" 失败。
[ERROR] [gzclient-3]: process has died [pid 6039, exit code -6, cmd 'gzclient --gui-client-plugin=libgazebo_ros_eol_gui.so --verbose'].
[gzclient-3]```
code_text
可以把我的模型简单地理解为一个风车。
我在旋转轴上加了一个 JointController 插件,通过 ros topic 发布速度以控制它的旋转。
但是现在这个 joint 并不旋转,而是连接的 child link 在旋转。
这导致了我无法通过 /tf 获取风车扇叶上某点的实时位置,我通过 /tf 或者 /static_tf 获取的都是静止的,没有旋转的扇叶点的三维坐标。
我在 Rviz2 里面观察我的风车也能看到,它没有在旋转。但是在 Gazebo 中能观察到旋转。
以下是我的 xacro 文件。我通过
robot_description = ParameterValue(Command(['xacro ', buff_model_path]), value_type=str) robot_state_publisher_node = Node( package='robot_state_publisher', executable='robot_state_publisher', parameters=[{'robot_description': robot_description}] ) joint_state_publisher_node = Node( package='joint_state_publisher', executable='joint_state_publisher', name='joint_state_publisher', parameters=[{'robot_description': robot_description}] ) spawn_entity_cmd = Node( package='ros_gz_sim', executable='create', arguments=['-name', 'buff', '-topic', 'robot_description', '-x', '0.0', '-y', '0.0', '-z', '0.0'], output='screen' )将其发布到我的世界里。
<?xml version="1.0"?> <robot name="buff" xmlns:xacro="http://www.ros.org/wiki/xacro"> <xacro:property name="M_PI" value="3.1415926535"/> <xacro:property name="fan_arm_length" value="0.7"/> <gazebo> <plugin filename="gz-sim-joint-controller-system" name="gz::sim::systems::JointController"> <joint_name>base_horizon_base_axle</joint_name> <initial_velocity>1.0471975512</initial_velocity> <topic>/changeBuffSpeed</topic> </plugin> </gazebo> <xacro:macro name="base_cube" params="name a b c mass"> <link name="${name}"> <visual name="visual"> <geometry> <box size="${a} ${b} ${c}"/> </geometry> </visual> <collision name="collision"> <geometry> <box size="${a} ${b} ${c}"/> </geometry> </collision> <inertial> <mass value="${mass}"/> <origin rpy="0 0 0" xyz="0 0 0"/> <inertia ixx="${mass*(b*b + c*c)/12}" ixy="0" ixz="0" iyy="${mass*(a*a + c*c)/12}" iyz="0" izz="${mass*(a*a + b*b)/12}"/> </inertial> </link> <gazebo reference="${name}"> <material>Gazebo/Red</material> <!-- 修正重力标签语法 --> <gravity>true</gravity> </gazebo> </xacro:macro> <xacro:macro name="joint" params="parent child type xyz rpy"> <joint name="${parent}_${child}" type="${type}"> <parent link="${parent}"/> <child link="${child}"/> <origin xyz="${xyz}" rpy="${rpy}"/> <axis xyz="0 0 1"></axis> </joint> </xacro:macro> <xacro:macro name="base_cylinder" params="name radius length"> <link name="${name}"> <visual name="visual"> <geometry> <cylinder radius="${radius}" length="${length}"/> </geometry> </visual> <collision name="collision"> <geometry> <cylinder radius="${radius}" length="${length}"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0 0 0" xyz="0 0 0"/> <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6"/> </inertial> </link> </xacro:macro> <xacro:macro name="withPNG_cylinder" params="name radius length mesh"> <link name="${name}"> <visual name="visual"> <geometry> <mesh filename="$(find sim)/model/${mesh}"/> </geometry> </visual> <collision name="collision_${name}"> <geometry> <cylinder radius="${radius}" length="${length}"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0 0 0" xyz="0 0 0"/> <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6"/> </inertial> </link> </xacro:macro> <xacro:macro name="buff_fan" params="prefix reflect fan_id special"> <xacro:base_cube name="${prefix}_fan_arm_${fan_id}" a="${fan_arm_length}" b="0.050" c="0.04" mass="1.0"/> <xacro:base_cube name="${prefix}_fan_${fan_id}" a="0.372" b="0.372" c="0.05" mass="1.0"/> <xacro:withPNG_cylinder name="${prefix}_fan_hitArea_${fan_id}" radius="0.15" length="0.05" mesh="targets.dae"/> <xacro:joint parent="R_logo_${prefix}" child="${prefix}_fan_arm_${fan_id}" type="fixed" xyz="${-cos((fan_id-1)*72/180*M_PI)*fan_arm_length/2} ${-sin((fan_id-1)*72/180*M_PI)*fan_arm_length/2} ${special}" rpy="0 0 ${72*(fan_id-1)/180*M_PI}" /> <xacro:joint parent="${prefix}_fan_arm_${fan_id}" child="${prefix}_fan_${fan_id}" type="fixed" xyz="${-fan_arm_length/2} 0 0" rpy="0 0 0" /> <xacro:joint parent="${prefix}_fan_${fan_id}" child="${prefix}_fan_hitArea_${fan_id}" type="fixed" xyz="0 0 ${0.00001*reflect}" rpy="0 0 0"/> </xacro:macro> <xacro:base_cylinder name="base_axle" radius="0.008" length="0.2"/> <xacro:macro name="buff" params="prefix reflect"> <xacro:withPNG_cylinder name="R_logo_${prefix}" radius="0.106" length="0.05" mesh="R_logo.dae"/> <xacro:joint parent="base_axle" child="R_logo_${prefix}" type="fixed" xyz="0 0 ${reflect*0.1}" rpy="0 0 0"/> <xacro:buff_fan reflect="${reflect}" prefix="${prefix}" fan_id="1" special="0"/> <xacro:buff_fan reflect="${reflect}" prefix="${prefix}" fan_id="2" special="0"/> <xacro:buff_fan reflect="${reflect}" prefix="${prefix}" fan_id="3" special="0"/> <xacro:buff_fan reflect="${reflect}" prefix="${prefix}" fan_id="4" special="0"/> <xacro:buff_fan reflect="${reflect}" prefix="${prefix}" fan_id="5" special="0"/> </xacro:macro> <xacro:base_cube name="base" a="3.00" b="3.00" c="0.10" mass="9.0"/> <xacro:base_cube name="base_left" a="0.15" b="0.15" c="2.60" mass="1.0"/> <xacro:base_cube name="base_right" a="0.15" b="0.15" c="2.60" mass="1.0"/> <xacro:base_cube name="base_horizon" a="0.15" b="1.80" c="0.15" mass="1.0"/> <link name="world"/> <joint name="fixed" type="fixed"> <parent link="world"/> <child link="base"/> </joint> <xacro:joint parent="base" child="base_horizon" type="fixed" xyz="0 0.0 2.6" rpy="0 0 0"/> <xacro:joint parent="base_horizon" child="base_left" type="fixed" xyz="0 -0.9 -1.3" rpy="0 0 0"/> <xacro:joint parent="base_horizon" child="base_right" type="fixed" xyz="0 0.9 -1.3" rpy="0 0 0"/> <xacro:joint parent="base_horizon" child="base_axle" type="continuous" xyz="0 0.0 0.0" rpy="0 ${M_PI/2} 0"/> <xacro:buff prefix="front" reflect=" 1"/> <xacro:buff prefix="back" reflect="-1"/> </robot>或者有什么别的插件可以获取扇叶点的实时位置吗?
CMake Error at CMakeLists.txt:15 (find_package):
By not providing "Findserial.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "serial", but
CMake did not find one.
Could not find a package configuration file provided by "serial" with any
of the following names:
Add the installation prefix of "serial" to CMAKE_PREFIX_PATH or set
"serial_DIR" to a directory containing one of the above files. If "serial"
provides a separate development package or SDK, be sure it has been
installed.
home/zztg/桌面/zztg_robot_node/src/Robot_SeeWorld.cpp: In member function ‘void CameraPublisherNode::timerCallback()’:
/home/zztg/桌面/zztg_robot_node/src/Robot_SeeWorld.cpp:47:28: error: no matching function for call to ‘rclcpp::Publisher<sensor_msgs::msg::Image_<std::allocator<void> > >::publish(sensor_msgs::msg::Image_<std::allocator<void> >::SharedPtr&)’
47 | image_pub_->publish(msg);
| ~~~~~~~~~~~~~~~^
In file included from /opt/ros/humble/include/rclcpp/rclcpp/topic_statistics/subscription_topic_statistics.hpp:31,
from /opt/ros/humble/include/rclcpp/rclcpp/subscription.hpp:50,
from /opt/ros/humble/include/rclcpp/rclcpp/any_executable.hpp:25,
感觉像是docker出错了,没能拉到合适的下载源
Unable to find image 'fishros2/ros:noetic-desktop-full' locally
docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Run 'docker run --help' for more information
Run CMD Task:[docker exec -it noetic1 /bin/bash -c "echo -e '
source /opt/ros/noetic/setup.bash' >> ~/.bashrc" ]
Error response from daemon: No such container: noetic1
Run CMD Task:[xhost +local:]
non-network local connections being added to access control list
0ca60c4698972232a8b3eb1a04321da.jpg
*
代码直接从gitee上拷贝的。
版块
-
1.2k
主题4.6k
帖子 -
349
主题2.3k
帖子 -
5
主题33
帖子 -
931
主题3.9k
帖子 -
918
主题3.4k
帖子 -
3
主题7
帖子 -
341
主题1.5k
帖子