gluon使用记录贴

Q1:ros编译出现error: no matching function for call to ‘ros_control_boilerplate::GenericHWControlLoop::GenericHWControlLoop(ros::NodeHandle&, boost::shared_ptr&)’

S1:猜测是ros版本变化导致函数参数的类型更改,在ros noetic版本中,第二个参数由boost::shared_ptr改为std::shared_ptr。可使用析构函数完成类型转换。

template
void do_release(typename boost::shared_ptr const&, T*)
{
}
template
typename std::shared_ptr to_std(typename boost::shared_ptr const& p)
{
    return
        std::shared_ptr(
                p.get(),
                boost::bind(&do_release, p, _1));

}

然后在需要类型转换的地方先定义一个std::shared_ptr类型 再调用to_std函数即可解决。

补充:将传递的参数在定义时的boost::shared_ptr直接修改为std::shared_ptr也可。

Q2:在现成功能包中添加py文件并运行,出现ERROR:Found the following, but they're either not files,[rosrun] or not executable:

S2:该执行文件无权限,chmod 777 xxx.py即可。引用用的库在功能包的cmakelist.txt package.xml对应修改即可

Q3:编译python文件出现 AttributeError: 'tuple' object has no attribute 'serialize'

S3:将代码中 traj = arm.plan() 修改为 plan_success,traj,planning_time,error_code = arm.plan()

运行编译成功。但出现提示

        Fail: ABORTED: No motion plan found. No execution attempted.  说明四元数非单位四元数,修改成对应的即可

Q4: AttributeError: 'ArmController' object has no attribute 'moveit_commander'

S4:本身构建模块的问题,不是所有函数前都要加self.的 有些本身就是模块名称引用了。

Q5:创建python库文件 调用时出现TypeError: 'module' object is not callable

S5:库文件名称与模块名称一致,需修改文件名称为不同名字 并且在开头引入 from xx import xx

Q6:在笛卡尔规划中出现 ABORTED: Solution found but controller failed during execution

S6:在普通规划里,只需重启一遍demo.launch即可;但在笛卡尔的直线规划中,解决方式待写。

Q7:在ubuntu中使用串口工具cutecom,发送数据没有反应

S7:首先,检查端口的问题 使用串口工具前需执行以下命令

# 使能串口
dmesg | grep ttyS*
# 打开cutecom 需要开权限
sudo cutecom

        查看对应端口操作的命令

# 先cd 到/dev目录下
cd /dev
# 再查看端口 即会显示串口号
ls ttyUSB*
# 如要在代码中连接串口 记得开权限
sudo chmod 666 ttyUSB*

        使用串口发送或接收数据时需要注意 进制转换

Q8:rviz正常启动,但无法打开joint_state_publisher_gui,但确定安装了对应包。

S8:可能launch文件中的joint_state_publisher全部更换为joint_state_publisher_gui,即

你可能感兴趣的:(自动驾驶,人工智能,机器学习)