Skip to content

Instantly share code, notes, and snippets.

@comoc
comoc / scantest.cpp
Created February 22, 2024 14:03 — forked from bertrandmartel/scantest.cpp
Bluez BLE scanning example (port of https://github.com/carsonmcdonald/bluez-experiments in C++)
// g++ scantest.cpp -lbluetooth
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <iostream>
#include <signal.h>
#include <bluetooth/bluetooth.h>
@comoc
comoc / AckermannSteering.cs
Last active January 18, 2024 23:15
Ackermann Steering Geometory for Unity in C#
using UnityEngine;
public class AckermannSteering : MonoBehaviour
{
[SerializeField] private float steeringAngle; // ステアリングの切れ角
[SerializeField] private float tread; // 左右の車輪間の距離 (トレッド)
[SerializeField] private float wheelBase; // 前後の車輪間の距離 (ホイールベース)
public float leftWheelAngle { get; private set; } // 左車輪の角度
public float rightWheelAngle { get; private set; } // 右車輪の角度
@comoc
comoc / gist:e784fefea4f16186f89f16010a1e8398
Last active September 18, 2020 06:48
@chikuta さんのプリメイドAIのURDFをUnity ROS#で表示する方法

準備

@chikuta さんのpremaidai_descriptionのURDFを ROS(Kinetic等)とROS#を使ってUnity上に召喚する方法

1. ROSのcatkin_ws内の作業

URDFをrosbridge websocketで送出するための作業

  1. https://github.com/siemens/ros-sharp/tree/master/ROS の file_server フォルダ以下を丸ごと catkin_ws/src 以下に置く
  2. cd catkin_ws/src そして git clone https://github.com/chikuta/premaidai_description.git
  3. premaidai_description/launch 内に以下の内容を記述した fileserver.launch という名前のファイルを作る
@comoc
comoc / mydll.c
Last active November 8, 2018 06:13
WindowsのGUIアプリやDLL内からのprintfを画面表示する方法 ref: https://qiita.com/comocc/items/4604bea440018dfb5bd1
#include <windows.h>
#include <stdio.h>
__declspec(dllexport) void __cdecl Function1(void) {
printf_s("%s\n", __func__); /* 標準出力 */
/* または */
fprintf_s(stdout, "%s\n", __func__); /* 標準出力 */
}
__declspec(dllexport) void __cdecl Function2(void) {
@comoc
comoc / GitignoreGenerator.cs
Created June 26, 2018 09:12
An editor extension makes easier to add a .gitignore file to the root folder of current Unity project
// Please locate this file as Assets/Editor/GitignoreGenerator.cs
// Then select "Custom" > "Add .gitignore to project root from menu".
using UnityEngine;
using UnityEngine.Networking;
using UnityEditor;
using System.IO;
using System;
public class GitignoreGenerator : EditorWindow {
@comoc
comoc / file0.txt
Last active April 13, 2018 03:02
python-oscで0がFalseになってしまう時の対処方法 ref: https://qiita.com/comocc/items/f247b8d14a6067b4fc79
from pythonosc import osc_message_builder
from pythonosc import udp_client
if __name__ == "__main__":
client = udp_client.UDPClient("127.0.0.1", 5005)
msg = osc_message_builder.OscMessageBuilder(address="/my_address")
msg.add_arg(0)
msg = msg.build()
@comoc
comoc / cr.c
Last active October 27, 2017 12:56
ASCII文字の16進表現の値を調べる各種の方法 ref: http://qiita.com/comocc/items/0dab7f5aac9dc7e43d07
#include <stdio.h>
int main(void)
{
printf("%x\n", '\n');
return 0;
}
@comoc
comoc / file0.txt
Last active August 3, 2017 13:15
NNablaをWindows 10上のPython 3.5環境にインストールする ref: http://qiita.com/comocc/items/b5deb52bf99e5f193494
C:\Users\user>pip install nnabla
Collecting nnabla
Using cached nnabla-0.9.2-cp35-cp35m-win_amd64.whl
(中略)
copying skimage\_shared\tests\__init__.py -> build\lib.win-amd64-3.5\skimage\_shared\tests
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
@comoc
comoc / file0.txt
Created April 20, 2017 05:09
Vagrant上のVMへのmecab-ipadic-neologdのインストールが失敗する時 ref: http://qiita.com/comocc/items/bfa5c4fe3c84d31e8ae7
(前略)
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
reading ./mecab-user-dict-seed.20170417.csv ... /home/ubuntu/mecab-ipadic-neologd/bin/../libexec/make-mecab-ipadic-neologd.sh: line 492: 2130 Aborted (core dumped) ${MECAB_LIBEXEC_DIR}/mecab-dict-index -f UTF8 -t UTF8
@comoc
comoc / file0.txt
Last active March 21, 2017 08:16
AutodeskのForge Viewerを利用してFBXファイルを表示する ref: http://qiita.com/comocc/items/04e6a06e87d06dac20da
curl -v 'https://developer.api.autodesk.com/authentication/v1/authenticate' \
-X 'POST' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'client_id=[CLIENT_ID]&client_secret=[CLIENT_SECRET]&grant_type=client_credentials&scope=bucket:create%20bucket:read%20data:write%20data:read'