diff --git a/.vscode/sftp.json b/.vscode/sftp.json new file mode 100644 index 0000000..f733c42 --- /dev/null +++ b/.vscode/sftp.json @@ -0,0 +1,9 @@ +{ + "name": "My Server", + "host": "localhost", + "protocol": "sftp", + "port": 22, + "username": "username", + "remotePath": "/", + "uploadOnSave": true +} diff --git a/MoveitMechanicalArmSimulation/README.md b/MoveitMechanicalArmSimulation/README.md index 79ded2e..206859d 100644 --- a/MoveitMechanicalArmSimulation/README.md +++ b/MoveitMechanicalArmSimulation/README.md @@ -137,9 +137,5 @@ rosrun moveit_tutorials state_note.py **步骤3** 在move_group_python_interface_tutorial.py的端口按提示改变机械臂的状态,并且实时地检测并且写入串口设备 -``` -chmod +x state_note.py -rosrun moveit_tutorials state_note.py -``` -![](../figures/moveit.jpg) +![](../figures/joint_state.jpg) diff --git a/MoveitMechanicalArmSimulation/state_note.py b/MoveitMechanicalArmSimulation/state_note.py index 42167f1..12e18c6 100644 --- a/MoveitMechanicalArmSimulation/state_note.py +++ b/MoveitMechanicalArmSimulation/state_note.py @@ -52,7 +52,7 @@ if __name__ == '__main__': group_name = "panda_arm" move_group = moveit_commander.MoveGroupCommander(group_name) - ser = serial.Serial('/dev/ttyAMA0', 3000000, 8, 'N', 1) # 'COM7', 3000000, bytesize=8, parity='N', stopbits=1 + ser = serial.Serial('/dev/ttyAMA0', 3000000, 8, 'N', 1) flag = ser.is_open if flag: @@ -63,7 +63,7 @@ if __name__ == '__main__': time_step = 0 begin_time = datetime.datetime.now() one_step = 2 - + while True: cur_time = (datetime.datetime.now() - begin_time).total_seconds() if cur_time >= (time_step + one_step): @@ -71,8 +71,12 @@ if __name__ == '__main__': joint_goal = move_group.get_current_joint_values() print("joint:", joint_goal[0], joint_goal[1], joint_goal[2], joint_goal[3], joint_goal[4], joint_goal[5], joint_goal[6]) - ser.write("help".encode('utf-8')) - print("ok?") + # ser.write("help".encode('utf-8')) + joint_len = len(joint_goal) + for i in range(joint_len): + tmp_val = joint_goal[i] + str = '%.3f'%tmp_val + ser.write(str.encode('utf-8')) if ISSIGINTUP: ser.close() print("Exit") diff --git a/figures/joint_state.jpg b/figures/joint_state.jpg new file mode 100644 index 0000000..8e719d8 Binary files /dev/null and b/figures/joint_state.jpg differ