embeded/robot2026. 7. 3. 12:25

일단은 micro HDMI 연결해서 시도.

 

다행히 x11 forwarding으로 되네. 모니터 안달아도 되겠다

ros2shell
ros2 run turtlesim turtlesim_node
ros2 run turtlesim turtle_teleop_key

 

하라는 대로 해보면 아래처럼 나온다.

ssh로 해서 귀찮아서 백그라운드로 돌리고 쑈하는 중

G(gola), B(?) 누르면 아래처럼 메시지가 나온다.

(ros2 galactic py3)er@er:~$ ros2 run turtlesim turtlesim_node
[INFO] [1783047470.975415679] [turtlesim]: Starting turtlesim with node name /turtlesim
[INFO] [1783047470.985410507] [turtlesim]: Spawning turtle [turtle1] at x=[5.544445], y=[5.544445], theta=[0.000000]
^Z
[1]+  Stopped                 ros2 run turtlesim turtlesim_node
(ros2 galactic py3)er@er:~$ bg
[1]+ ros2 run turtlesim turtlesim_node &
(ros2 galactic py3)er@er:~$ ros2 run turtlesim turtle_teleop_key
Reading from keyboard
---------------------------
Use arrow keys to move the turtle.
Use G|B|V|C|D|E|R|T keys to rotate to absolute orientations. 'F' to cancel a rotation.
'Q' to quit.
[INFO] [1783047541.329042626] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047541.872528190] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047541.888733657] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047541.904818475] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047541.919834899] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047541.952188870] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047541.984665508] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047542.016009140] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047542.048402795] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047542.080809062] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047542.112165583] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047542.144652053] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047542.176082352] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047542.192223411] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047542.224715381] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047542.256142236] [turtlesim]: Rotation goal completed successfully
[WARN] [1783047543.335142919] [turtlesim]: Rotation goal received before a previous goal finished. Aborting previous goal
[INFO] [1783047543.806747242] [turtlesim]: Rotation goal completed successfully
[WARN] [1783047545.833930732] [turtlesim]: Rotation goal received before a previous goal finished. Aborting previous goal
[INFO] [1783047545.834608550] [turtlesim]: Rotation goal completed successfully
[INFO] [1783047547.348717894] [turtlesim]: Rotation goal completed successfully

 

B 눌러서 살짝 돌아간 거북이

 

 

 

실행하면 먼가 나오는데

(ros2 galactic py3)er@er:~$ rqt_graph

 

hide 쪽 다 끄니 먼가 좀 나온다.

 

아니면 위에 topic을 적어주면 먼가 나온다.

[링크 : https://m.blog.naver.com/zeta0807/221775210962]

 

-v 옵션  줘서 topic list를 하면 위의 그래프와 동일한 내용이 나온다.

(ros2 galactic py3)er@er:~$ ros2 topic -h
usage: ros2 topic [-h] [--include-hidden-topics] Call `ros2 topic <command> -h` for more detailed usage. ...

Various topic related sub-commands

optional arguments:
  -h, --help            show this help message and exit
  --include-hidden-topics
                        Consider hidden topics as well

Commands:
  bw     Display bandwidth used by topic
  delay  Display delay of topic from timestamp in header
  echo   Output messages from a topic
  find   Output a list of available topics of a given type
  hz     Print the average publishing rate to screen
  info   Print information about a topic
  list   Output a list of available topics
  pub    Publish a message to a topic
  type   Print a topic's type

  Call `ros2 topic <command> -h` for more detailed usage.

(ros2 galactic py3)er@er:~$ ros2 topic list
/parameter_events
/rosout
/turtle1/cmd_vel
/turtle1/color_sensor
/turtle1/pose

(ros2 galactic py3)er@er:~$ ros2 topic list -v
Published topics:
 * /parameter_events [rcl_interfaces/msg/ParameterEvent] 2 publishers
 * /rosout [rcl_interfaces/msg/Log] 2 publishers
 * /turtle1/color_sensor [turtlesim/msg/Color] 1 publisher
 * /turtle1/pose [turtlesim/msg/Pose] 1 publisher

Subscribed topics:
 * /parameter_events [rcl_interfaces/msg/ParameterEvent] 2 subscribers
 * /turtle1/cmd_vel [geometry_msgs/msg/Twist] 1 subscriber

[링크 : https://docs.elephantrobotics.com/docs/gitbook-en/12-ApplicationBaseROS/12.2-ROS2/12.2.2-基础教程.html]

 

하라는 대로 하니 되긴한다. 좋네~

(ros2 galactic py3)er@er:~/colcon_ws$ colcon build --symlink-install
Starting >>> mycobot_description
Starting >>> mycobot_interfaces
Starting >>> mypalletizer_interfaces                                                       
Starting >>> mecharm_interfaces
Finished <<< mycobot_description [9.82s]                                                              
[Processing: mecharm_interfaces, mycobot_interfaces, mypalletizer_interfaces]                                             
[Processing: mecharm_interfaces, mycobot_interfaces, mypalletizer_interfaces]                                                 
Finished <<< mecharm_interfaces [1min 10s]                                              
[Processing: mycobot_interfaces, mypalletizer_interfaces]                               
[Processing: mycobot_interfaces, mypalletizer_interfaces]                               
Finished <<< mycobot_interfaces [2min 26s]                                               
Starting >>> mycobot_communication
Starting >>> mecharm_communication                                                                                    
Finished <<< mypalletizer_interfaces [2min 28s]                                                                           
Starting >>> mypalletizer_communication                                                               
Finished <<< mycobot_communication [10.3s]                                                                  
Starting >>> mybuddy
Starting >>> mycobot_280                                                                                                     
Finished <<< mecharm_communication [10.4s]                                                                      
Starting >>> mecharm
Finished <<< mypalletizer_communication [10.6s]                                                                        
Starting >>> mecharm_pi                                                                        
Finished <<< mecharm [13.1s]                                                                                          
Starting >>> mycobot_280jn
Finished <<< mybuddy [13.4s]                                                                                               
Starting >>> mycobot_280pi
Finished <<< mycobot_280 [13.5s]                                                                             
Starting >>> mycobot_320                                                                                    
Finished <<< mecharm_pi [11.9s]                                                                                 
Starting >>> mycobot_320pi                                                                                  
Finished <<< mycobot_280jn [12.5s]                                                                                
Starting >>> mypalletizer_260
Finished <<< mycobot_320 [12.7s]                                                                                 
Finished <<< mycobot_280pi [14.6s]                                                                               
Starting >>> mypalletizer_260_pi
Starting >>> ultraarm
Finished <<< mycobot_320pi [11.3s]                                                                                         
Finished <<< mypalletizer_260 [10.2s]                                                                              
Finished <<< mypalletizer_260_pi [10.3s]                                                  
Finished <<< ultraarm [10.3s]

Summary: 18 packages finished [3min 17s]
(ros2 galactic py3)er@er:~/colcon_ws$ source install/setup.bash
(ros2 galactic py3)er@er:~/colcon_ws$ ros2 launch mycobot_280pi slider_control.launch.py

[INFO] [launch]: All log files can be found below /home/er/.ros/log/2026-07-03-11-17-17-203959-er-9929
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [9959]
[INFO] [joint_state_publisher_gui-2]: process started with pid [9961]
[INFO] [rviz2-3]: process started with pid [9963]
[INFO] [slider_control-4]: process started with pid [9965]
[robot_state_publisher-1] Link joint2 had 1 children
[robot_state_publisher-1] Link joint3 had 1 children
[robot_state_publisher-1] Link joint4 had 1 children
[robot_state_publisher-1] Link joint5 had 1 children
[robot_state_publisher-1] Link joint6 had 1 children
[robot_state_publisher-1] Link joint6_flange had 0 children
[robot_state_publisher-1] [INFO] [1783048639.394243790] [robot_state_publisher]: got segment joint1
[robot_state_publisher-1] [INFO] [1783048639.394549934] [robot_state_publisher]: got segment joint2
[robot_state_publisher-1] [INFO] [1783048639.394636748] [robot_state_publisher]: got segment joint3
[robot_state_publisher-1] [INFO] [1783048639.394680932] [robot_state_publisher]: got segment joint4
[robot_state_publisher-1] [INFO] [1783048639.394718784] [robot_state_publisher]: got segment joint5
[robot_state_publisher-1] [INFO] [1783048639.394756061] [robot_state_publisher]: got segment joint6
[robot_state_publisher-1] [INFO] [1783048639.394793246] [robot_state_publisher]: got segment joint6_flange
[joint_state_publisher_gui-2] [INFO] [1783048643.531952578] [joint_state_publisher]: Waiting for robot_description to be published on the robot_description topic...
[joint_state_publisher_gui-2] [INFO] [1783048643.610075662] [joint_state_publisher]: Centering
[joint_state_publisher_gui-2] [INFO] [1783048644.027434405] [joint_state_publisher]: Centering
[rviz2-3] [INFO] [1783048644.403594556] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-3] [INFO] [1783048644.404085494] [rviz2]: OpenGl version: 3.1 (GLSL 1.4)
[rviz2-3] [INFO] [1783048647.151156049] [rviz2]: Stereo is NOT SUPPORTED
[slider_control-4] array('d', [0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
[slider_control-4] array('d', [-0.0004613180000001549, -0.0004613180000001549, -0.0004613180000001549, -0.0004613180000001549, -0.0004613180000001549, -0.0004613180000001549])

 

 

 

실제 장비가 움직이는진 모르겠지만 뜨긴한다.

$ ros2 launch mycobot_280 test.launch.py
[INFO] [launch]: All log files can be found below /home/er/.ros/log/2026-07-03-11-23-38-154196-er-10335
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [10367]
[INFO] [joint_state_publisher_gui-2]: process started with pid [10369]
[INFO] [rviz2-3]: process started with pid [10371]
[robot_state_publisher-1] Link joint2 had 1 children
[robot_state_publisher-1] Link joint3 had 1 children
[robot_state_publisher-1] Link joint4 had 1 children
[robot_state_publisher-1] Link joint5 had 1 children
[robot_state_publisher-1] Link joint6 had 1 children
[robot_state_publisher-1] Link joint6_flange had 0 children
[robot_state_publisher-1] Link env had 0 children
[robot_state_publisher-1] [INFO] [1783049020.099496084] [robot_state_publisher]: got segment env
[robot_state_publisher-1] [INFO] [1783049020.099850118] [robot_state_publisher]: got segment joint1
[robot_state_publisher-1] [INFO] [1783049020.099978210] [robot_state_publisher]: got segment joint2
[robot_state_publisher-1] [INFO] [1783049020.100036728] [robot_state_publisher]: got segment joint3
[robot_state_publisher-1] [INFO] [1783049020.100077783] [robot_state_publisher]: got segment joint4
[robot_state_publisher-1] [INFO] [1783049020.100116357] [robot_state_publisher]: got segment joint5
[robot_state_publisher-1] [INFO] [1783049020.100152116] [robot_state_publisher]: got segment joint6
[robot_state_publisher-1] [INFO] [1783049020.100192041] [robot_state_publisher]: got segment joint6_flange
[rviz2-3] [INFO] [1783049023.998647585] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-3] [INFO] [1783049023.999256988] [rviz2]: OpenGl version: 3.1 (GLSL 1.4)
[joint_state_publisher_gui-2] [INFO] [1783049024.105868138] [joint_state_publisher]: Waiting for robot_description to be published on the robot_description topic...
[joint_state_publisher_gui-2] [INFO] [1783049024.137961673] [joint_state_publisher]: Centering
[joint_state_publisher_gui-2] [INFO] [1783049024.490631764] [joint_state_publisher]: Centering
[rviz2-3] [INFO] [1783049026.693983324] [rviz2]: Stereo is NOT SUPPORTED

 

[링크 : https://docs.elephantrobotics.com/docs/gitbook-en/12-ApplicationBaseROS/12.2-ROS2/12.2.4-rviz介绍及使用/myCobot-280.html]

'embeded > robot' 카테고리의 다른 글

mycobot ros1/ros2  (0) 2026.07.02
gcode (g-code)  (0) 2026.07.01
mycobot280 pi / TCP(tool center point)  (0) 2026.06.30
mycobot 280 pi / python  (0) 2026.06.29
왼손 오른손 좌표계  (0) 2026.06.22
Posted by 구차니
embeded/robot2026. 7. 2. 18:20

설치는 나중에 해보고 일단 사용법이나 찾아보는 중

매번 해보려고 해도 잘 안되서 답답하네

장치에서 깔려있는걸로 바로 시도해볼수 있나보다.

# The default serial port name of mycobot 280-PI version is "/dev/ttyAMA0", and the baud rate is 1000000. 
ros2 launch mycobot_280pi slider_control.launch.py



[링크 : https://docs.elephantrobotics.com/docs/gitbook-en/12-ApplicationBaseROS/12.2-ROS2/12.2.4-rviz介绍及使用/myCobot-280.html]

 


# The default serial port name of mycobot 280-PI version is "/dev/ttyAMA0", and the baud rate is 1000000.
ros2 launch mycobot_280pi teleop_keyboard.launch.py

Mycobot Teleop Keyboard Controller
---------------------------
Movimg options(control coordinations [x,y,z,rx,ry,rz]):
              w(x+)

    a(y-)     s(x-)     d(y+)

    z(z-) x(z+)

u(rx+)   i(ry+)   o(rz+)
j(rx-)   k(ry-)   l(rz-)

Gripper control:
    g - open
    h - close

Other:
    1 - Go to init pose
    2 - Go to home pose
    3 - Resave home pose
    q - Quit

currently:    speed: 10    change percent: 2



[링크 : https://docs.elephantrobotics.com/docs/gitbook-en/12-ApplicationBaseROS/12.2-ROS2/12.2.4-rviz介绍及使用/myCobot-280.html]

[링크 : https://docs.elephantrobotics.com/docs/gitbook-en/12-ApplicationBaseROS/12.2-ROS2/12.2.2-基础教程.html]

    [링크 : https://docs.elephantrobotics.com/docs/gitbook-en/12-ApplicationBaseROS/12.2-ROS2/12.2.3-ROS2介绍.html]

 

'embeded > robot' 카테고리의 다른 글

elephant robototics mycobot ros2  (0) 2026.07.03
gcode (g-code)  (0) 2026.07.01
mycobot280 pi / TCP(tool center point)  (0) 2026.06.30
mycobot 280 pi / python  (0) 2026.06.29
왼손 오른손 좌표계  (0) 2026.06.22
Posted by 구차니
embeded/robot2026. 7. 1. 16:05

어떻게 카와이하게 별 모양을 따나 코드 분석

gpt 에서 분석 떠넘김 ㅋㅋ

 

단위가 없네.. 

G20 / G21 하면 인치 / 밀리미터로 되는 듯.

[링크 : https://reprap.org/wiki/G-code#G20:_Set_Units_to_Inches]

[링크 : https://reprap.org/wiki/G-code#G21:_Set_Units_to_Millimeters]

 

G90 으로 절대좌표 모드로 설정하고 그리는데

G90                      // 절대좌표 모드(원점 기준 좌표 사용)
G4 S1                    // 1초 대기
G01 X170 Y0 Z60 F15      // X170 Y0 Z60 위치로 직선 이동, 이송속도 F15
G4 S1                    // 1초 대기
G0 X195.54 Y-32.03       // 빠른 이동으로 별의 시작점으로 이동
G0 Z49.00                // 작업 높이(Z=49)까지 하강
G1 X195.54 Y-9.66        // 직선 가공
G1 X215.61 Y-2.75        // 오른쪽 위 꼭짓점으로 이동
G1 X195.54 Y4.16         // 왼쪽으로 이동
G1 X195.54 Y26.52        // 위쪽 꼭짓점으로 이동
G1 X183.14 Y8.43         // 왼쪽 위 대각선 이동
G1 X163.08 Y15.34        // 왼쪽 꼭짓점으로 이동
G1 X175.48 Y-2.75        // 중앙 방향으로 이동
G1 X163.08 Y-20.84       // 왼쪽 아래 꼭짓점으로 이동
G1 X183.14 Y-13.93       // 오른쪽 아래 대각선 이동
G1 X195.54 Y-32.03       // 시작점으로 복귀하여 도형 완성
G0 Z70.00                // 공구를 안전 높이(Z=70)로 상승
G0 X189.34 Y-2.75        // 다음 작업 또는 대기 위치로 빠른 이동
M21 P0                   // 제조사 전용 M코드(예: 펜, 그리퍼, 디지털 출력 등 장비별 기능)

[링크 : https://github.com/elephantrobotics/pymycobot/blob/main/demo/myCobot_280_demo/five_point_star.nc]

 

초기 위치와 끝나고 돌아오는 것을 제외하고 그려보면

아래처럼 5각형 별이 그려진다. 순서는 대충 눈으로 따라가면 외곽선만 따라가는 것 같다.

[링크 : https://reprap.org/wiki/G-code]

'embeded > robot' 카테고리의 다른 글

elephant robototics mycobot ros2  (0) 2026.07.03
mycobot ros1/ros2  (0) 2026.07.02
mycobot280 pi / TCP(tool center point)  (0) 2026.06.30
mycobot 280 pi / python  (0) 2026.06.29
왼손 오른손 좌표계  (0) 2026.06.22
Posted by 구차니
embeded/robot2026. 6. 30. 15:18

위대하신(!) GPT 님께 질문을 바꾸어서 해보니 답을 내려주시었다!

from pymycobot.mycobot import MyCobot

mc = MyCobot("/dev/ttyAMA0", 1000000)

# Tool TCP 설정
# x, y, z, rx, ry, rz
mc.set_tool_reference([0, 0, 100, 0, 0, 0])

# End Type을 Tool로 변경
mc.set_end_type(1)

[링크 : https://chatgpt.com/share/6a435d66-1bd0-83ee-a338-b2b1932bee98]

 

send_angles([0,0,0,0,0,0], 10) 을 이용해서 쭉 펴면

이렇게 생겨 먹어서 굳이... 하자면 아래 기준 y축 방향이긴 한데

[링크 : https://docs.elephantrobotics.com/docs/gitbook-en/2-serialproduct/2.1-280/2.1.5-PI-2023.html]

 

gpt로 물어보고 다시 설명을 보니 다 써있었구나.. -_ㅠ

T in the figure is the set tool coordinate system. The posture of this coordinate system is consistent with O’, and the relative displacement of the origin has occurred. Use the python function to set the tool coordinate system:

set_tool_reference([x, y, z, rx, ry, rz]) //Set tool coordinate system
set_end_type(1) //Set the end coordinate system type as tool
Assume that the tool coordinate system T is not rotated relative to O' (rx = ry = rz = 0)
Assume that the origin of the tool coordinate system T is in the coordinate system O’ at (x = 0, y = 0, z = 100mm)
The final tool coordinate system parameter is set_tool_reference(0, 0, 100, 0, 0, 0)

 

그런데 왜 끝부분의 z 축은 가장 아래의 x 축을 보고 있는걸까?

 

[링크 : https://docs.elephantrobotics.com/docs/gitbook-en/2-serialproduct/2.1-280/Kinematics&Coordinate.html]

 

2.3 set_tool_reference(coords)

Function: Set Tool coordinate system。
Parameters:
coords: The coordinate value of [x, y, z, rx, ry, rz] has a length of 6, x, y, z ranging from - 280 to 280, and rx, ry, yz ranging from - 314 to 314
Return Value: None


2.4 get_tool_reference()

Function: Get Tool coordinate system。
Return Value: Returns a coordinate list with a length of 6


2.9 set_end_type(end)

Function: Set end coordinate system。
Parameters:
end: 0 - flange(default),1 - tool
Return Value: None


3.0 get_end_type()

Function: Get end coordinate system
Return Value: 0 - flange(default),1 - tool, -1 - error

[링크 : https://docs.elephantrobotics.com/docs/gitbook-en/7-ApplicationBasePython/7.3_coord.html]

 

+

해보니 잘 된다.

set_end_type() 의 문제였던 듯.

set_end_type(1) 해주고 나서 set_coords() 에서 rx 를 오가게 하니 된다.

'embeded > robot' 카테고리의 다른 글

mycobot ros1/ros2  (0) 2026.07.02
gcode (g-code)  (0) 2026.07.01
mycobot 280 pi / python  (0) 2026.06.29
왼손 오른손 좌표계  (0) 2026.06.22
mycobot280_pi urdf  (0) 2026.06.22
Posted by 구차니
embeded/robot2026. 6. 29. 18:09

atom 이랑 팔에 힘빼는거(!) 테스트

 

from pymycobot.mycobot import MyCobot
from pymycobot import PI_PORT, PI_BAUD
mc = MyCobot(PI_PORT, PI_BAUD)
mc.set_color(0,0,255)
mc.get_digital_input(39) # atom 누르지 않고
1
mc.get_digital_input(39) # atom 누르고
0
mc.power_off() # atom off
mc.get_digital_input(39) # atom 안 읽힘
mc.get_digital_input(39)
mc.power_on() # atom on
mc.get_digital_input(39) # atom 누르지 않고
1
mc.get_digital_input(39) # atom 누르고
0
mc.is_power_on()
1
mc.power_off()
mc.is_power_on()
0
mc.power_on()


mc.power_off()
mc.is_all_servo_enable()
mc.power_on()
mc.is_all_servo_enable()

 

power_on 은 atom(LED, 버튼 일체형) 통신 뿐만 아니라

servo 전원 on/off도 같이 엮인다.

1.1 power_on()     Function: Atom open communication (default open)
1.2 power_off()     Function: Atom turn off communication
1.3 is_power_on() Function: judge whether robot arms is powered on or not

 

서보(관절별) 잠그고, 푸는 명령

2.11 release_servo(servo_id) Function: release a servo
5.4 focus_servo(servo_id)    Function: power on designated servo

 

gpt 보고 짜달라니 잘 짜준다

#!/usr/bin/env python3

import curses
import time

from pymycobot.mycobot import MyCobot
from pymycobot import PI_PORT, PI_BAUD

# -------------------------------------------------
# myCobot
# -------------------------------------------------
mc = MyCobot(PI_PORT, PI_BAUD)

SPEED = 40
STEP = 2.0        # mm
ROT_STEP = 2.0    # degree

released = True

mc.power_on()
time.sleep(1)

coords = mc.get_coords()

if coords is None:
    print("Cannot read robot coordinates.")
    exit(1)


# -------------------------------------------------
def draw_screen(stdscr, angles):

    stdscr.clear()

    stdscr.addstr(0, 0, "myCobot 280 Jog Controller")

    stdscr.addstr(2, 0, "A/D : X -/+")
    stdscr.addstr(3, 0, "W/S : Y +/-")
    stdscr.addstr(4, 0, "R/F : Z +/-")
    stdscr.addstr(5, 0, "Q/E : RX -/+")
    stdscr.addstr(6, 0, "ESC : Exit")

    stdscr.addstr(8, 0, f"Servo : {'LOCK' if released else 'RELEASE'}")

    stdscr.addstr(
        10, 0,
        f"X={coords[0]:7.2f}  "
        f"Y={coords[1]:7.2f}  "
        f"Z={coords[2]:7.2f}"
    )

    stdscr.addstr(
        11, 0,
        f"RX={coords[3]:7.2f}  "
        f"RY={coords[4]:7.2f}  "
        f"RZ={coords[5]:7.2f}"
    )

    if angles is not None:
        stdscr.addstr(13, 0, "Joint Angles")

        for i, a in enumerate(angles):
            stdscr.addstr(14+i, 0, f"J{i+1}: {a:7.2f}")

    stdscr.refresh()


# -------------------------------------------------
def main(stdscr):

    global coords
    global released

    curses.cbreak()
    curses.noecho()

    stdscr.nodelay(True)
    stdscr.keypad(True)

    angles = mc.get_angles()

    draw_screen(stdscr, angles)

    while True:

        # ------------------------------------------
        # Atom Button
        # ------------------------------------------

        button = mc.get_digital_input(39)

        if button == 0 and released:

            released = False

            mc.release_all_servos()

            draw_screen(stdscr, angles)

        elif button == 1 and not released:

            released = True

            mc.power_on()

            time.sleep(0.5)

            # Servo를 손으로 움직였을 수 있으므로
            # 이때만 실제 좌표를 다시 읽음
            new_coords = mc.get_coords()
            if new_coords is not None:
                coords = new_coords

            angles = mc.get_angles()

            draw_screen(stdscr, angles)

        key = stdscr.getch()

        if key == 27:
            break

        moved = False

        if released:

            if key == ord('a'):
                coords[0] -= STEP
                moved = True

            elif key == ord('d'):
                coords[0] += STEP
                moved = True

            elif key == ord('w'):
                coords[1] += STEP
                moved = True

            elif key == ord('s'):
                coords[1] -= STEP
                moved = True

            elif key == ord('r'):
                coords[2] += STEP
                moved = True

            elif key == ord('f'):
                coords[2] -= STEP
                moved = True

            elif key == ord('q'):
                coords[3] -= ROT_STEP
                moved = True

            elif key == ord('e'):
                coords[3] += ROT_STEP
                moved = True

            if moved:
                mc.send_coords(coords, SPEED, 1)
                draw_screen(stdscr, angles)

        time.sleep(0.02)


# -------------------------------------------------
if __name__ == "__main__":
    curses.wrapper(main)

 

[링크 : https://docs.elephantrobotics.com/docs/gitbook-en/7-ApplicationBasePython/7.2_API.html]

'embeded > robot' 카테고리의 다른 글

gcode (g-code)  (0) 2026.07.01
mycobot280 pi / TCP(tool center point)  (0) 2026.06.30
왼손 오른손 좌표계  (0) 2026.06.22
mycobot280_pi urdf  (0) 2026.06.22
블루로봇 밸런스 스테이지  (0) 2026.06.21
Posted by 구차니
embeded/robot2026. 6. 22. 23:06

이게 먼소리여..

유니버셜 로봇 강의 가서

다른 사람들이 손가락으로 막 이상한 짓(?) 하고 있어서

웬지 좌표계 같아서 찾아보는데 이해가 안된다 ㅠㅠ

 

좀 보다 보니..

오른손 좌표계에서

축 증가방향 - 엄지(x) 검지(y) 중지(z)

축 회전방향 - 따봉했을때 검지-중지-약지-새끼 의 방향

 

 

[링크 : https://dev-igner.tistory.com/51]

[링크 : https://hyekunamatata.tistory.com/14]

'embeded > robot' 카테고리의 다른 글

mycobot280 pi / TCP(tool center point)  (0) 2026.06.30
mycobot 280 pi / python  (0) 2026.06.29
mycobot280_pi urdf  (0) 2026.06.22
블루로봇 밸런스 스테이지  (0) 2026.06.21
elephant robotics cobot python api  (0) 2026.06.19
Posted by 구차니
embeded/robot2026. 6. 22. 22:51

URDF 포맷의 정보를 이용하면 관절관의 거리 등이 있어서

ROS2 나 moveit2 에서 충돌 검사를 통해서 자기 파괴하지 않도록 할 수 있다고 한다.

 

moveit은 ros 1용

moveit2는 ros 2 용인듯. 그런데 단독 사용은 안되려나?

[링크 : https://github.com/moveit/moveit2]

 

<?xml version="1.0"?>
<robot  xmlns:xacro="http://www.ros.org/wiki/xacro" name="firefighter" >

<xacro:property name="width" value=".2" />


  <link name="g_base">
    <visual>
      <geometry>
        <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/G_base.dae"/>
      </geometry>
      <origin xyz = "0.0 0 -0.03" rpy = "0 0 1.5708"/>
    </visual>
    <collision>
      <geometry>
        <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/G_base.dae"/>
      </geometry>
      <origin xyz = "0.0 0 -0.03" rpy = "0 0 1.5708"/>
    </collision>
  </link>

  <link name="joint1">
    <visual>
      <geometry>
     <!--- 0.0 0 -0.04  1.5708 3.14159-->
       <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/joint1_pi.dae"/>
      </geometry>
    <origin xyz = "0.0 0 0 " rpy = " 0 0 0"/>
    </visual>
    <collision>
      <geometry>
     <!--- 0.0 0 -0.04  1.5708 3.14159-->
       <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/joint1_pi.dae"/>
      </geometry>
    <origin xyz = "0.0 0 0 " rpy = " 0 0 0"/>
    </collision>
  </link>

  <link name="joint2">
    <visual>
      <geometry>
       <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/joint2.dae"/>
      </geometry>
    <origin xyz = "0.0 0 -0.06096 " rpy = " 0 0 -1.5708"/>
    </visual>
      <collision>
      <geometry>
       <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/joint2.dae"/>
      </geometry>
    <origin xyz = "0.0 0 -0.06096 " rpy = " 0 0 -1.5708"/>
    </collision>
  </link>


  <link name="joint3">
    <visual>
      <geometry>
       
       <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/joint3.dae"/>
      </geometry>
    <origin xyz = "0.0 0 0.03256 " rpy = " 0 -1.5708 0"/>
    </visual>
      <collision>
        <geometry>
       <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/joint3.dae"/>
      </geometry>
    <origin xyz = "0.0 0 0.03256 " rpy = " 0 -1.5708 0"/>
    </collision>
  </link>


  <link name="joint4">
    <visual>
      <geometry>
       <!--- 0.0 0 -0.04 -->
       <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/joint4.dae"/>
      </geometry>
    <origin xyz = "0.0 0 0.03056 " rpy = " 0 -1.5708 0"/>
    </visual>
      <collision>
      <geometry>
       <!--- 0.0 0 -0.04 -->
       <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/joint4.dae"/>
      </geometry>
    <origin xyz = "0.0 0 0.03056 " rpy = " 0 -1.5708 0"/>
    </collision>
  </link>




<link name="joint5">
    <visual>
      <geometry>
       <!--- 0.0 0 -0.04 -->
       <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/joint5.dae"/>
      </geometry>
    <origin xyz = "0.0 -0.001 -0.0345 " rpy = " 0 -1.5708 1.5708"/>
    </visual>
      <collision>
      <geometry>
       <!--- 0.0 0 -0.04 -->
       <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/joint5.dae"/>
      </geometry>
    <origin xyz = "0.0 -0.001 -0.0345 " rpy = " 0 -1.5708 1.5708"/>
    </collision>
  </link>


  <link name="joint6">
    <visual>
      <geometry>
       <!--- 0.0 0 -0.04 -->
       <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/joint6.dae"/>
      </geometry>
    <origin xyz = "0 0.00 -0.038 " rpy = " 0 0 0"/>
    </visual>
      <collision>
      <geometry>
       <!--- 0.0 0 -0.04 -->
       <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/joint6.dae"/>
      </geometry>
    <origin xyz = "0 0.00 -0.038 " rpy = " 0 0 0"/>
    </collision>
  </link>


  <link name="joint6_flange">
    <visual>
      <geometry>
       <!--- 0.0 0 -0.04 -->
       <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/joint7.dae"/>
      </geometry>
    <origin xyz = "0.0 0 -0.012 " rpy = " 0 0 0"/>
    </visual>
      <collision>
      <geometry>
       <!--- 0.0 0 -0.04 -->
       <mesh filename="package://mycobot_description/urdf/mycobot_280_pi/joint7.dae"/>
      </geometry>
    <origin xyz = "0.0 0 -0.012 " rpy = " 0 0 0"/>
    </collision>
  </link>


  <joint name="g_base_to_joint1" type="fixed">
    <axis xyz="0 0 0"/>
    <limit effort = "1000.0" lower = "-3.14" upper = "3.14159" velocity = "0"/>
    <parent link="g_base"/>
    <child link="joint1"/>
    <origin xyz= "0 0 0" rpy = "0 0 0"/>  
  </joint>


  <joint name="joint2_to_joint1" type="revolute">
    <axis xyz="0 0 1"/>
    <limit effort = "1000.0" lower = "-2.9321" upper = "2.9321" velocity = "0"/>
    <parent link="joint1"/>
    <child link="joint2"/>
    <origin xyz= "0 0 0.13956" rpy = "0 0 0"/>  
  </joint>


  <joint name="joint3_to_joint2" type="revolute">
    <axis xyz="0 0 1"/>
    <limit effort = "1000.0" lower = "-2.4434" upper = "2.4434" velocity = "0"/>
    <parent link="joint2"/>
    <child link="joint3"/>
    <origin xyz= "0 0 -0.001" rpy = "0 1.5708 -1.5708"/>  
  </joint>


  <joint name="joint4_to_joint3" type="revolute">
    <axis xyz=" 0 0 1"/>
    <limit effort = "1000.0" lower = "-2.6179" upper = "2.6179" velocity = "0"/>
    <parent link="joint3"/>
    <child link="joint4"/>
    <origin xyz= "  -0.1104 0 0   " rpy = "0 0 0"/>  
  </joint>



  <joint name="joint5_to_joint4" type="revolute">
    <axis xyz=" 0 0 1"/>
    <limit effort = "1000.0" lower = "-2.6179" upper = "2.6179" velocity = "0"/>
    <parent link="joint4"/>
    <child link="joint5"/>
    <origin xyz= "-0.096 0 0.06462" rpy = "0 0 -1.5708"/>  
  </joint>

  <joint name="joint6_to_joint5" type="revolute">
    <axis xyz="0 0 1"/>
    <limit effort = "1000.0" lower = "-2.7052" upper = "2.7925" velocity = "0"/>
    <parent link="joint5"/>
    <child link="joint6"/>
    <origin xyz= "0 -0.07318 -0.001" rpy = "1.5708 -1.5708 0"/>  
  </joint>

  <joint name="joint6output_to_joint6" type="revolute">
    <axis xyz="0 0 1"/>
    <limit effort = "1000.0" lower = "-3.14" upper = "3.14159" velocity = "0"/>
    <parent link="joint6"/>
    <child link="joint6_flange"/>
    <origin xyz= "0 0.0456 0" rpy = "-1.5708 0 0"/>  
  </joint>



</robot>

[링크 : https://github.com/elephantrobotics/mycobot_ros/blob/noetic/mycobot_description/urdf/mycobot_280_pi/mycobot_280_pi.urdf]

 

 

엥 ur5e 니가 왜 여기서 나와 -ㅁ-

[링크 : https://github.com/jdj2261/pykin]

[링크 : https://ropiens.tistory.com/177] << 볼 것 링크

 

'embeded > robot' 카테고리의 다른 글

mycobot 280 pi / python  (0) 2026.06.29
왼손 오른손 좌표계  (0) 2026.06.22
블루로봇 밸런스 스테이지  (0) 2026.06.21
elephant robotics cobot python api  (0) 2026.06.19
elephant robotics mycobot 280 pi python 예제  (0) 2026.06.16
Posted by 구차니
embeded/Cortex-M3 STM2026. 6. 22. 12:21

AVR 때는 자주 쓴거 같은데

stm32 되면서 함수를 통해 1개 핀에 대해서만 바꾸다 보니 불편해서 찾아보는데

머.. 결국은 레지스터 건드릴 수 밖에 없는 듯

 

ODR 값 읽고 마스킹 후에 한번에 갈아 치우는게 나을 듯

If you want the whole port (all 16 pins) get the value, then you simply write it to the ODR register:
GPIOB->ODR = 0xFFFF; //writing 1/0 in a bit position, 
sets/resets that bit. ALL BITS ARE AFFECTED no matter the value your write in.

If you want to set some pins, but not altering the other pins, with one instruction:
GPIOB->BSRR = 0x00F; //writing 1 in a bit position, 
sets that bit leaves the others as they are

If you want to reset some pins, but not altering the other pins, with one instruction:
GPIOB->BRR = 0x00F; //writing 1 in a bit position, 
clears that bit and leaves the others as they are

If you want a "portion" of a GPIO port to get an specific value, this method is 2 instructions instead of "read-change-write":
GPIOB->BRR = 0x00F; //clear the first 4 bits
GPIOB->BSRR = 0x00A; //set the desired bits in that 4-bit field

 

 ODR 정도는 low level 함수로 존재하나 보다.

using LL API:

LL_GPIO_WriteOutputPort(GPIOA,x);

[링크 : https://electronics.stackexchange.com/questions/683401/can-i-write-a-8-bit-or-16-bit-data-to-the-outport-of-the-stm32-directly]

 

wtite_bits(uint16_t cmd)
{
    uint32_t data = GPIOA -> ODR;

    data &= ~(0x1fff);
    data |= cmd & 0x1fff;
    GPIOA -> ODR = data;

    data = GPIOB -> ODR;
    data &= ~(0x0007);
    data |= (cmd & 0x8fff) >> 13;
    GPIOB -> ODR = data;
}

[링크 : https://stackoverflow.com/questions/48365156/stm32f4-write-read-16bits-into-two-8-bit-gpio-port]

'embeded > Cortex-M3 STM' 카테고리의 다른 글

stm32 uart data bit  (0) 2026.03.17
stm32 다른 영역으로 점프(부트로더)  (0) 2026.03.06
stm32cubeide cpp 변환이후 generate code  (0) 2026.02.25
mbed + stm32cube hal...?  (0) 2026.02.23
Mbed studio on ubuntu 22.04  (0) 2026.02.23
Posted by 구차니
embeded/robot2026. 6. 21. 18:57

유튜브 보다가 광고를 다 본건 또 첨이네 ㅋㅋㅋ

 

처음에는 이게 머하는 거여~ 싶었는데

보다보니 만져볼만큼 싼 곳에 들어갈 장비가 아니라는 느낌만 잔뜩~ 드는 녀석

[링크 : https://www.youtube.com/watch?v=jJ7jJ0ciF4g]

[링크 : https://www.youtube.com/watch?v=SKrBfwh6R_8]

[링크 : https://bluerobot.co.kr/]

 

아래는 유튜브 광고 찾기 ㅋㅋㅋ

[링크 : https://adstransparency.google.com/?platform=YOUTUBE&region=KR]

    [링크 : https://www.reddit.com/r/youtube/comments/1kajmpx/how_to_find_an_ad_i_saw/?tl=ko]

'embeded > robot' 카테고리의 다른 글

왼손 오른손 좌표계  (0) 2026.06.22
mycobot280_pi urdf  (0) 2026.06.22
elephant robotics cobot python api  (0) 2026.06.19
elephant robotics mycobot 280 pi python 예제  (0) 2026.06.16
유니버셜 로봇 polyscope 5  (0) 2026.06.16
Posted by 구차니
embeded/Cortex-M4 STM2026. 6. 19. 14:58

BOOT1 이라고 오른쪽 중간에 있는 곳을 잘 보면

BOOT0가 있는데 그걸 좌측 세번째 X3 crystal 근처의 3V 와 연결(pull up)

 

우측의 SDRAM 이라고 써있는 근처에 PA9 PA10를 USB TTL UART에 적당히~ 연결해주면 끝

[링크 : https://www.st.com/resource/en/user_manual/um1670-discovery-kit-with-stm32f429zi-mcu-stmicroelectronics.pdf]

 

잘 읽네. 그런데 속도 못 올리나.. 쩝..

$ stm32flash /dev/ttyUSB0 
stm32flash 0.5

http://stm32flash.sourceforge.net/

Interface serial_posix: 57600 8E1
Version      : 0x31
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0419 (STM32F42xxx/43xxx)
- RAM        : Up to 192KiB  (12288b reserved by bootloader)
- Flash      : Up to 2048KiB (size first sector: 1x16384)
- Option RAM : 65552b
- System RAM : 30KiB

 

$ stm32flash -r dump.bin /dev/ttyUSB0 
stm32flash 0.5

http://stm32flash.sourceforge.net/

Interface serial_posix: 57600 8E1
Version      : 0x31
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0419 (STM32F42xxx/43xxx)
- RAM        : Up to 192KiB  (12288b reserved by bootloader)
- Flash      : Up to 2048KiB (size first sector: 1x16384)
- Option RAM : 65552b
- System RAM : 30KiB
Memory read
Read address 0x08052100 (16.03%) ^C

 

'embeded > Cortex-M4 STM' 카테고리의 다른 글

stm32_programmer_cli 를 이용한 option byte 변경  (0) 2026.03.19
NUCLEO-WL55JC  (0) 2026.03.17
stm32g473 ART accelerator on/off ?  (0) 2026.02.06
stm32g473 flash doubleword  (0) 2026.02.04
STM32G47x dual bank flash  (0) 2026.02.03
Posted by 구차니