顯示具有 STM32F4 標籤的文章。 顯示所有文章
顯示具有 STM32F4 標籤的文章。 顯示所有文章

2014年6月19日 星期四

Compiling uROSnode

uROSnode
We can find it on Github: https://github.com/openrobots-dev/uROSnode
It is a great work for MCU can run ROS.
https://dl.dropboxusercontent.com/u/2771793/uros/doc/html/pag_demos.html
One great explainition about this project: pdf
ROSCon: http://vimeo.com/66970254

Problem 1:
Compiling ./src/urosUser.c
In file included from ../../include/urosUser.h:45:0,
                 from ./src/urosUser.c:42:
./src/urosUser.c: In function 'urosUserParamUpdate':
./src/urosUser.c:353:21: error: 'UrosRpcParam' has no member named 'class'
     urosError(paramp->class != UROS_RPCP_INT, return UROS_ERR_BADPARAM,
                     ^
../../include/urosBase.h:323:50: note: in definition of macro 'urosError'
 #  define urosError(when, action, msgargs) { if (when) { action; } }
                                                  ^
./src/urosUser.c:368:21: error: 'UrosRpcParam' has no member named 'class'
     urosError(paramp->class != UROS_RPCP_INT, return UROS_ERR_BADPARAM,
                     ^
../../include/urosBase.h:323:50: note: in definition of macro 'urosError'
 #  define urosError(when, action, msgargs) { if (when) { action; } }
                                                  ^
./src/urosUser.c:383:21: error: 'UrosRpcParam' has no member named 'class'
     urosError(paramp->class != UROS_RPCP_INT, return UROS_ERR_BADPARAM,
                     ^
../../include/urosBase.h:323:50: note: in definition of macro 'urosError'
 #  define urosError(when, action, msgargs) { if (when) { action; } }
                                                  ^
make: *** [build/obj/urosUser.o] Error 1
Fix:
Find the struct in uROSnode/include/urosRpcCall.h

typedef struct UrosRpcParam {

  uros_rpcparamclass_t      pclass;      /**< @brief Parameter pclass.*/

  union {

    UrosString              string;     /**< @brief XMLRPC string.*/

    int32_t                 int32;      /**< @brief XMLRPC int/i4.*/

    uros_bool_t             boolean;    /**< @brief XMLRPC boolean.*/

    double                  real;       /**< @brief XMLRPC double.*/

    UrosString              base64;     /**< @brief XMLRPC base64.*/

    void                    *mapp;      /**< @brief XMLRPC struct (map pointer).*/ /* TODO */

    struct UrosRpcParamList *listp;     /**< @brief XMLRPC array (list pointer).*/

  }                         value;      /**< @brief Parameter value.*/

} UrosRpcParam;


Then, just change the variable name from class to pclass. The error seems caused by typo.


Problem 2:
/src/lld/lwip/uros_lld_conn.c:784: undefined reference to `netconn_set_sendtimeout'

At first, I think it seems the lwip version caused error.
Change from 1.4.0 to 1.4.1
However, problem still exist.
/../../ext/lwip/src/api/api_lib.c:627: undefined reference to `sys_now'
build/obj/api_msg.o: In function `do_writemore':
/home/kv/rosnode/ChibiOS_2.5.1/demos/uROSnode/demos/turtlesim-chibios+lwip/../../../../ext/lwip/src/api/api_msg.c:1228: undefined reference to `sys_now'
collect2: error: ld returned 1 exit status
make: *** [build/turtlesim.elf] Error 1
Fix:
Then i just do the dirty thing. That I comment sys_now in 
lwip/src/api/api_msg.c
and 
lwip/src/api/api_lib.c
cause they have no instance.

Finally, the compilation is d
one.

st-flash write build/turtlesim.bin 0x08000000
2014-06-19T16:29:51 INFO src/stlink-common.c: Starting verification of write complete
2014-06-19T16:29:54 INFO src/stlink-common.c: Flash written and verified! jolly good!

But it doesn't Run! Obviously, we have different hardware module with their. 



The difficulty then will be porting the peripheral to the STM32F407 which we using Discovery.

I think porting this could be a great help to my robot!

2013年12月24日 星期二

Visual Servo Project

影像伺服開發日誌

目標:用攝影機定位輸送帶上的物件,當偵測正確的物品時,利用機械手臂夾持。


硬體設備



  • Raspberry Pi model B 
  • Raspi camera 
  • 機械手臂
預算
  • 六自由度舵機支架含底盤 - 3738 NTD
  • 32路舵機控制板 + 五個伺服馬達(舵機)- 2426 NTD





---------------------------------------------------------------


日期:2013 / 12 / 23 


由於32路舵機控制器需要用到UART下達指令,我們先安裝 bcm2835 的 C library for Raspberry Pi方便 Pi 週邊的操作。

      Refer to C library for Broadcom BCM 2835 as used in Raspberry Pi








今天最後卡在不知道怎麼用PI上的GPIO送出UART訊號,由Console接收。帶明天解決。

<Note>
How about using stm32f4 for servo motor controller ?
Use pwm to control servo, and read UART as commands. Let can be better.
Need a servo motors' power controller (board)

Reference :




---------------------------------------------------------------

2013 / 12 / 25 :  聖誕快樂XD

Today I face the mmal_vc_port_info_set failed ERROR Q_Q

Disappointing for setting raspicam. The problem should be pending and i need dealing with UART stuff.

About GPIO


Refer to GPIO functions 


Well, I get something without using bcm2835 but using <termios.h>


Reference : 

----------------------------------------------------------------------------------------------------------------------

2013/12/26 


舵機測試



  • 電壓:1.5 V * 4 = 6 V
  • 尚未接 PWM,之後量測Duty cycle與角度關係是否準確


Specs : MG995 Servo
  • Weight  : 55g 
  • Stall torque 8.5kg/cm (4.8V) / 10kg/cm (6V)
  • Operating voltage : 4.8 ~ 7.2 V
  • Dead bandwidth : 5 us
  • 金屬齒輪塑膠外殼


手臂組裝過程
這次買的跺機組與支架品質不太好,賣家似乎也不太專業:(




目前組裝為兩個自由度,再加上一個夾持共三個馬達。
底座不能旋轉,因為實際物品跟拍賣圖上不一樣 Orz
這個底座台沒辦法妥當安置Base Servo。



接下來要想辦法從Raspberry Pi 控制手臂,送UART命令到
  • 32 Channels Servo Controller 
  • STM32F4 Discovery
接下來得了解32路控制器。Tomorrow I will focus on servo control with PWM.

----------------------------------------------------------------------------------------------------------------------

2013 / 12 / 30

Well, after two days break, time to get back to the track XD

今天量測了PD12送出的PWM 是否符合預期


  • Period :50 Hz ( 20ms )
  • Duty Cycle :5% ~ 10 %

讀到Counter的數值也符合預期,應該可以直接用在伺服馬達控制上。


開始 trace RaspiCam + OpenCV的程式。
-----------------------------------------------------------------------------------------

Raspiberry Pi camera 用的是ov5647晶片,參考Specs連結

Code Trace 的部份正在進行,不過內容太多了寫到另外一篇中,請參考 raspicam-code-review

2014 / 1 / 1 
--------------------------------------------------------------------------------------
在把Code 中的 imshow() 關掉後可以得到 30 fps 的結果(640 * 480 ),這樣的速度還算不錯,不過要進行運算的時候還是需要硬體上的加速,接著得研究ARM提供的NEON了。

Reference : 

Maybe it should be halted!!

< Robot Arm Controller Note > 
In main: serial_msg rx_msg; 
In sys_manager: xQueueHandle serial_rx_queue;
In main : serial_rx_queue = xQueueCreate(1, sizeof(serial_msg));

今天改裝了手臂,買了小零件讓底盤可以轉動


小盤有四個螺絲孔,順利的鎖上支架,成為手臂裡最牢固的一個零件XD


為了讓中柱可以穩固,中間加上了墊片,鎖到伺服馬達的中心上。

側視圖


目前手臂的外觀
接下來需要一個配電的電路板(可能來不及作穩流電路了),所以選用電池時先不考慮鋰電池了。

It is probably useful : Intro of OpenVG


2014 / 1 / 3 
--------------------------------------------------------------------------------------
將收到的 usart message 堆在 queue 中,接著透過這個函式送回來。
xQueueSendToBackFromISR()

2014 / 1 / 10
--------------------------------------------------------------------------------------




代辦事項
  • 測試相機修改一些多餘的程式碼,希望可以讓 640 * 480 大小下達到 30 fps 的水準
  • 研究NEON,利用SIMD加速運算
  • 經過 Macron 的提醒,可以嘗試開啟GPU,加速影像方面的計算
    • 他說可以開到1080p彩圖,資源消耗 ~ 30%
    • 將Raspbian 中不必要的程式刪除,最後留下(~20KB,不太記得了)的網路與影像套件
  • 試著加入Optical flow ,一方面測試利一方面作為之後專題使用
  • 完成 STM32F4 的 USART 接收功能(接近完成,希望能加上RTOS的Queue)
  • 海報照片和圖片
  • USB update
    • 怎麼量測封包與電源??@@
    • 查詢 550 mA 的電流上限