ROS_ARM_CROSSCOMPILE

 

 

https://github.com/mktk1117/ROS_ARM_CROSSCOMPILE

 mktk1117 Modified rostoolchain.cmake

Latest commit 430a694 on 24 Jan 2018

Permalink

TypeNameLatest commit messageCommit time
 Failed to load latest commit information.
configMade directories2 years ago
ros_indigoModified rostoolchain.cmake2 years ago
scriptsAdd turbojpeg building script2 years ago
.gitignoreFirst trial2 years ago
README.mdUpdate README.md2 years ago
arm-toolchain.cmakeFirst trial2 years ago

README.md

ROS_ARM_CROSSCOMPILE

ROS indigo cross compile for ARM architecture

Install build dependencies

First. you have to install build dependencies. Start with cloning this repositiory.

git clone https://github.com/mktk1117/ROS_ARM_CROSSCOMPILE.git
cd ROS_ARM_CROSSCOMPILE
source scripts/install_dependencies.sh

Cross compile dependencies

ROS depends on some libraries. You also have to cross compile these libraries. The script cross compiles for ARM architecture by using arm-linux-gnueabihf-gcc or g++.
It compiles

  • boost1.55
  • OpenCV2.4.9
  • bzip2-1.0.6.
  • lz4
  • console_bridge
  • Poco1.8.0.1
  • python 2.7
  • tinyXML

The script file build_dependencies.sh will cross compile above libraries into ROS_ARM_CROSSCOMPILE/arm-linux.

cd /your workspace/ROS_ARM_CROSSCOMPILE
source scripts/build_dependencies.sh

Cross Compile ROS

cd ros_indigo
catkin init
catkin config --merge-devel # this is important, otherwise you may get weird linking errors
catkin config --merge-install
catkin config --install
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release -DCROSS_ROOT=/your ws/ROS_ARM_CROSSCOMPILE -DCMAKE_TOOLCHAIN_FILE=/your ws/ROS_ARM_CROSSCOMPILE/ros_indigo/rostoolchain.cmake
rosinstall_generator ros_comm common_msgs sensor_msgs image_transport vision_opencv tf --rosdistro indigo --deps --wet-only --tar > ros-indigo-wet.rosinstall
wstool init -j8 src ros-indigo-wet.rosinstall
cd src
git clone https://github.com/catkin/catkin_simple.git
git clone https://github.com/mktk1117/glog_catkin.git
cd glog_catkin
git checkout arm-crosscompile
git pull
cd ../../
touch src/geometry2/tf2/test/CATKIN_IGNORE  # to avoid error
touch src/vision_opencv/image_geometry/test/CATKIN_IGNORE
touch src/geometry/tf/test/CATKIN_IGNORE
touch src/ros_comm/message_filters/test/CATKIN_IGNORE
catkin build

Latest commit 430a694 on 24 Jan 2018

Permalink

TypeNameLatest commit messageCommit time
 Failed to load latest commit information.
configMade directories2 years ago
ros_indigoModified rostoolchain.cmake2 years ago
scriptsAdd turbojpeg building script2 years ago
.gitignoreFirst trial2 years ago
README.mdUpdate README.md2 years ago
arm-toolchain.cmakeFirst trial2 years ago

README.md

ROS_ARM_CROSSCOMPILE

ROS indigo cross compile for ARM architecture

Install build dependencies

First. you have to install build dependencies. Start with cloning this repositiory.

git clone https://github.com/mktk1117/ROS_ARM_CROSSCOMPILE.git
cd ROS_ARM_CROSSCOMPILE
source scripts/install_dependencies.sh

Cross compile dependencies

ROS depends on some libraries. You also have to cross compile these libraries. The script cross compiles for ARM architecture by using arm-linux-gnueabihf-gcc or g++.
It compiles

  • boost1.55
  • OpenCV2.4.9
  • bzip2-1.0.6.
  • lz4
  • console_bridge
  • Poco1.8.0.1
  • python 2.7
  • tinyXML

The script file build_dependencies.sh will cross compile above libraries into ROS_ARM_CROSSCOMPILE/arm-linux.

cd /your workspace/ROS_ARM_CROSSCOMPILE
source scripts/build_dependencies.sh

Cross Compile ROS

cd ros_indigo
catkin init
catkin config --merge-devel # this is important, otherwise you may get weird linking errors
catkin config --merge-install
catkin config --install
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release -DCROSS_ROOT=/your ws/ROS_ARM_CROSSCOMPILE -DCMAKE_TOOLCHAIN_FILE=/your ws/ROS_ARM_CROSSCOMPILE/ros_indigo/rostoolchain.cmake
rosinstall_generator ros_comm common_msgs sensor_msgs image_transport vision_opencv tf --rosdistro indigo --deps --wet-only --tar > ros-indigo-wet.rosinstall
wstool init -j8 src ros-indigo-wet.rosinstall
cd src
git clone https://github.com/catkin/catkin_simple.git
git clone https://github.com/mktk1117/glog_catkin.git
cd glog_catkin
git checkout arm-crosscompile
git pull
cd ../../
touch src/geometry2/tf2/test/CATKIN_IGNORE  # to avoid error
touch src/vision_opencv/image_geometry/test/CATKIN_IGNORE
touch src/geometry/tf/test/CATKIN_IGNORE
touch src/ros_comm/message_filters/test/CATKIN_IGNORE
catkin build
这表明 `/TR_Arm_topic` 的消息类型是自定义的,名为 `robot_package/TR_Arm_Msg`。你需要查看该消息的具体结构才能正确构造或解析该消息。 --- ### 解决方案:查看并使用自定义消息 `TR_Arm_Msg` #### 1. 查看消息定义 要查看这个自定义消息的结构,可以使用以下命令: ```bash rosmsg show robot_package/TR_Arm_Msg ``` 这将输出类似如下内容(假设这是一个包含关节角度和状态标志的消息): ```bash float64[] joint_angles bool is_moving string status ``` 这意味着你可以通过构造一个包含 `joint_angles` 数组、`is_moving` 状态和 `status` 描述符串的消息来控制机械臂。 --- #### 2. 使用 Python 发送 `TR_Arm_Msg` 消息 首先确保你的 ROS 包已经编译,并且在 Python 脚本中可以导入自定义消息。 ##### 示例代码: ```python #!/usr/bin/env python import rospy from robot_package.msg import TR_Arm_Msg def control_arm(): rospy.init_node('arm_controller', anonymous=True) pub = rospy.Publisher('/TR_Arm_topic', TR_Arm_Msg, queue_size=10) rate = rospy.Rate(1) # 1Hz while not rospy.is_shutdown(): # 构造消息 msg = TR_Arm_Msg() msg.joint_angles = [0.0, 1.57, -1.57, 0.0, 0.0, 0.0] # 示例角度 msg.is_moving = True msg.status = "Moving to target position" rospy.loginfo("Publishing to /TR_Arm_topic: %s", msg) pub.publish(msg) rate.sleep() if __name__ == '__main__': try: control_arm() except rospy.ROSInterruptException: pass ``` --- #### 3. 说明与注意事项 - **消息类型**: `robot_package/TR_Arm_Msg` 是你自己的包中定义的 `.msg` 文件。 - **字段解释**: - `joint_angles`: 控制各个关节的角度。 - `is_moving`: 表示是否正在移动。 - `status`: 字符串用于反馈状态信息。 - **依赖项**: 确保你的 Python 脚本所在包的 `CMakeLists.txt` 和 `package.xml` 中包含了对 `robot_package` 的依赖。 - **运行脚本**: ```bash rosrun your_package_name arm_control.py ``` --- ###
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值