Ask Your Question

MiniMe's profile - activity

2020-12-26 17:40:57 -0500 received badge  Famous Question (source)
2020-12-26 17:40:57 -0500 received badge  Notable Question (source)
2020-12-26 17:40:57 -0500 received badge  Popular Question (source)
2020-12-24 12:29:41 -0500 asked a question Networked of microcontrollers

Networked of microcontrollers Hello everyone. Could you please guide me to the best practice for connecting 1 computer

2020-09-21 01:06:08 -0500 marked best answer Issue with include: In function 'main': Undefined reference to

Hello. I'm having an issue linking a header to my code. I'm trying to include libi2c from "https://github.com/amaork/libi2c" to use with ROS. (Stand alone this all works). I have a node called keyboard_nav: In it I have 'include', 'launch', and 'src' folders. I have a test CPP file called i2c_xavierROS:

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include "i2c.h"

using namespace std;

int main(int argc, char **argv)
{

    unsigned char buf[6];
    size_t buf_size = sizeof(buf);

    int fd;
    I2CDevice device;
    const char *data = "15291021";

    /* First open i2c bus */
    if ((fd = i2c_open("/dev/i2c-8")) == -1)
    {
        perror("Open i2c bus error");
        return -1;
    }

    /* Fill i2c device struct */
    device.bus = fd;
    device.addr = 0x0f;
    device.tenbit = 0;
    device.delay = 10;
    device.flags = 0;
    device.page_bytes = 8;
    device.iaddr_bytes = 0; /* Set this to zero, and using i2c_ioctl_xxxx API will ignore chip internal address */

    /* Write data to i2c */
    if (i2c_ioctl_write(&device, 0x0, data, strlen(data)) != strlen(data))
   {  /* Error process */ }

    /* Read data from i2c */
    if (i2c_ioctl_read(&device, 0x0, buf, buf_size) != buf_size)
    {
      for (int i = 0; i < buf_size; i++) {

            buf[i] = 0xff - i;
    }

    }

    i2c_close(fd);
    printf("buffer is ");
    printf("%s\n", buf);
/*
    for (i = 0; i < buf_size; i++)
    {

      //scanf( "%d", &buf[i]);
      printf("%s\n", buf);
    }*/
    return 0;

}

My #include "i2c.h" and i2c.c are saved in the include folder. Here is the CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(keyboard_nav)

find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs)
#add_executable for demo.cpp

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES keyboard_nav
#  CATKIN_DEPENDS roscpp rospy std_msgs
#  DEPENDS system_lib
)



include_directories(include ${catkin_INCLUDE_DIRS} )

add_executable(i2c_xavierROS src/i2c_xavierROS.cpp)
target_link_libraries(i2c_xavierROS ${catkin_LIBRARIES})
add_dependencies(i2c_xavierROS keyboard_nav_generate_messages_cpp)

When I run catkin_make I get this error:

CMakeFiles/i2c_xavierROS.dir/src/i2c_xavierROS.cpp.o: In function `main':
i2c_xavierROS.cpp:(.text+0x3a): undefined reference to `i2c_open'
i2c_xavierROS.cpp:(.text+0xaa): undefined reference to `i2c_ioctl_write'
i2c_xavierROS.cpp:(.text+0xd5): undefined reference to `i2c_ioctl_read'
i2c_xavierROS.cpp:(.text+0x112): undefined reference to `i2c_close'
collect2: error: ld returned 1 exit status
keyboard_nav/CMakeFiles/i2c_xavierROS.dir/build.make:113: recipe for target '/home/sp6david/henry_ws/devel/lib/keyboard_nav/i2c_xavierROS' failed
make[2]: *** [/home/sp6david/henry_ws/devel/lib/keyboard_nav/i2c_xavierROS] Error 1
CMakeFiles/Makefile2:872: recipe for target 'keyboard_nav/CMakeFiles/i2c_xavierROS.dir/all' failed
make[1]: *** [keyboard_nav/CMakeFiles/i2c_xavierROS.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j6 -l6" failed

I'd appreciate any help on fixing this.

2020-09-21 01:05:50 -0500 received badge  Famous Question (source)
2020-06-19 10:34:50 -0500 received badge  Famous Question (source)
2020-06-19 10:34:50 -0500 received badge  Notable Question (source)
2019-12-05 01:29:00 -0500 received badge  Popular Question (source)
2019-12-04 18:01:07 -0500 answered a question ros filing storage space excessively fast

Thanks for the input. I'll look into this more.

2019-12-04 18:01:07 -0500 received badge  Rapid Responder
2019-12-04 08:11:39 -0500 asked a question ros filing storage space excessively fast

ros filing storage space excessively fast Hello all. I've been having issues with storage space getting filled very fas

2019-12-01 13:35:13 -0500 received badge  Notable Question (source)
2019-11-29 05:49:14 -0500 edited answer Issue with include: In function 'main': Undefined reference to

I got this working with the target_link_libraries. Though there were many "tutorials" on how to do this they were over c

2019-11-29 05:45:31 -0500 answered a question Issue with include: In function 'main': Undefined reference to

I got this working with the target_link_libraries. Though there were many "tutorials" on how to do this they were over c

2019-11-26 17:20:50 -0500 received badge  Popular Question (source)
2019-11-25 14:02:17 -0500 commented answer Issue with include: In function 'main': Undefined reference to

Thanks for the fast reply. I'll try this and see what comes of it.

2019-11-25 14:02:17 -0500 received badge  Commentator
2019-11-25 10:03:23 -0500 asked a question Issue with include: In function 'main': Undefined reference to

Issue with include: In function 'main': Undefined reference to Hello. I'm having an issue linking a header to my code. I

2019-11-24 15:45:12 -0500 commented question libi2c ros wrapper

Hi. Did you ever get an answer to this issue or have you been able to get it working? I'm in a similar situation and wou

2018-09-10 12:26:26 -0500 marked best answer Trouble running robot_upstart

Hello all.

I installed ros_upstart with this command sudo apt-get install ros-indigo-robot-upstar.

I can find the files in /opt/ros/indigo/lib/robot_upstart/ and /opt/ros/indigo/lib/python2.7/dist-packages/robot_upstart.

I also did echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc and source ~/.bashrc.

After starting roscore I run this comand

rosrun robot_upstart install myrobot_bringup/launch/base.launch

and I get this error

Unable to locate path launch/base.launch in package myrobot_bringup. Installation aborted.
Traceback (most recent call last):
  File "/opt/ros/indigo/lib/robot_upstart/install", line 32, in <module>
    exit(main())
  File "/opt/ros/indigo/lib/python2.7/dist-packages/robot_upstart/install_script.py", line 83, in main
    if os.path.isfile(found_path[0]):
IndexError: list index out of range

I also tried sudo service myrobot start and got

myrobot: unrecognized service

Am I running the command in the wrong directory? Do I need to change something that is specific to my machine?

In advance. Thanks for any help

2017-10-09 20:55:19 -0500 received badge  Student (source)
2017-02-15 20:48:37 -0500 received badge  Famous Question (source)
2016-07-28 15:05:23 -0500 received badge  Famous Question (source)
2016-07-28 15:05:23 -0500 received badge  Notable Question (source)
2016-07-28 15:05:23 -0500 received badge  Popular Question (source)
2016-07-26 03:28:37 -0500 received badge  Famous Question (source)
2016-07-17 06:19:54 -0500 received badge  Notable Question (source)
2016-07-17 05:43:07 -0500 answered a question roscd not woring

Not sure why things were not working originally when I was trying to roscd to beginner_tutorials as I was doing everything in one terminal and I was sourcing at the end. Regardless it is working now (I assume I was mistyping something). Thanks for the assistance.

2016-07-16 14:07:16 -0500 received badge  Popular Question (source)
2016-07-16 07:32:35 -0500 asked a question roscd not woring

Hello all.

I've been trying to get back into ROS but I keep having this issue of roscd not finding catkin_ws. I went as far as removing the catkin_ws folder and copying everything from the Catkin tutorial on how to setup a workspace but still the same results. These are the steps I took:

david@davidsPro3:~$ source /opt/ros/indigo/setup.bash

david@davidsPro3:~$ mkdir -p ~/catkin_ws/src

david@davidsPro3:~$ cd ~/catkin_ws/src

david@davidsPro3:~/catkin_ws/src$ catkin_init_workspace

Creating symlink "/home/david/catkin_ws/src/CMakeLists.txt" pointing to "/opt/ros/indigo/share/catkin/cmake/toplevel.cmake"
david@davidsPro3:~/catkin_ws/src$ cd ~/catkin_ws/
david@davidsPro3:~/catkin_ws$ catkin_make
Base path: /home/david/catkin_ws
Source space: /home/david/catkin_ws/src
Build space: /home/david/catkin_ws/build
Devel space: /home/david/catkin_ws/devel
Install space: /home/david/catkin_ws/install
####
#### Running command: "cmake /home/david/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/david/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/david/catkin_ws/install -G Unix Makefiles" in "/home/david/catkin_ws/build"
####
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Using CATKIN_DEVEL_PREFIX: /home/david/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/indigo
-- This workspace overlays: /opt/ros/indigo
-- Found PythonInterp: /usr/bin/python (found version "2.7.6") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/david/catkin_ws/build/test_results
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.6.18
-- BUILD_SHARED_LIBS is on
-- Configuring done
-- Generating done
-- Build files have been written to: /home/david/catkin_ws/build
####
#### Running command: "make -j4 -l4" in "/home/david/catkin_ws/build"
####

david@davidsPro3:~/catkin_ws$ source devel/setup.bash

david@davidsPro3:~/catkin_ws$ echo $ROS_PACKAGE_PATH

/home/david/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks

david@davidsPro3:~/catkin_ws$

Once done I opened a new terminal and ran roscd with the results below:

david@davidsPro3:~$ roscd catkin_ws

roscd: No such package/stack 'catkin_ws'

david@davidsPro3:~$ 

david@davidsPro3:~$ roscd

david@davidsPro3:/opt/ros/indigo$

I also did this followed by sourcing

Running command: "make -j4 -l4" in "/home/david/catkin_ws/build"

Thanks for and help and suggestions on why this is not working?

2016-04-22 05:33:54 -0500 received badge  Notable Question (source)
2016-01-15 21:39:48 -0500 received badge  Popular Question (source)
2016-01-15 02:41:57 -0500 commented question rosserial sending alphanumeric messages

I did use that button. It then gave me a blue box where it said enter code here. I'll make sure next time that that is what actually saves.

2016-01-15 01:01:02 -0500 asked a question rosserial sending alphanumeric messages

Hello All,

I'm trying to pass a message from my computer to an Arduino using rosserial. The type of message that I want to send is something along the lines of abcd123456 or 123.456abc. Overall length of message will be exactly that many characters every time but I'm not sure yet if there will be more letters and if the letters are first or last and if I'll have a decimal or not. I don't think these variances will make a difference in how the message is sent and received so that is why I have not decided on the exact format just yet.

Here is what I have started with:

#include <ros.h>
#include <std_msgs/String.h>

ros::NodeHandle nh;

const char *FromCPU;
char hello[13] = "hello world!";
char FromCPUArray [100];
byte gotit = LOW;

//////////////////////////////////////////

void messageCb( const std_msgs::String& msg)
{
  char* temp = NULL;
  FromCPU = msg.data;
  //temp = (char*)FromCPU;
  digitalWrite(13, HIGH-digitalRead(13));   // blink LED everytime new comand is received
  gotit = HIGH;
}
std_msgs::String str_msg;
ros::Subscriber<std_msgs::String> subscribe("NewDriverAndValue", &messageCb);
ros::Publisher oldFbPos("oldFbPos", &str_msg);

//////////////////////////////////////////

void setup()
{
  pinMode(13, OUTPUT);
  nh.initNode();
  nh.advertise(oldFbPos);
  nh.subscribe(subscribe);
}

//////////////////////////////////////////

void loop()
{

  str_msg.data = hello;
  if (gotit==HIGH)
  {
    oldFbPos.publish( &str_msg );      // Publishes the str_msg on oldFbPos
  }
  gotit = LOW;
  nh.spinOnce();
  delay(500);
}

I want the message to be an array or string so that I can separate the letters and numbers and the numbers into two parts.

Does FromCPU need to be a const char * or can it be received as an array? What is the most efficient way to send and receive this type of message?

Thanks

2015-12-20 04:12:24 -0500 received badge  Notable Question (source)
2015-12-18 08:49:19 -0500 received badge  Teacher (source)
2015-12-18 08:49:19 -0500 received badge  Self-Learner (source)
2015-12-18 08:03:53 -0500 answered a question No ros_lib on arduino IDE 1.6.6

I was able to get it all working by simply copying the ros_lib file from the old Arduino IDE to the new.

2015-12-17 21:21:18 -0500 received badge  Popular Question (source)
2015-12-17 00:16:55 -0500 asked a question No ros_lib on arduino IDE 1.6.6

I have been working with Arduino IDE 1.0.5. in which I have ros_lib examples and ROS is recognized. I have upgraded to the 1.6.6 IDE but can't get ROS setup properly. During install I purged the system of Arduino and installed the new IDE. I then when through the steps of adding ROS to the mix with no luck. After finishing all the steps and not having any luck I reinstalled the 1.0.5 IDE and ros_lib was there without any work.

Any suggestions on how to get ROS working with the new IDE?

Thanks

2015-12-15 00:55:37 -0500 asked a question arduino simulator emulator

I'm looking for advice on which would be the best or ideal arduino simulator/emulator that allows ROS. I want to have the ability to use rosserial and wire to simulate 3 arduinos over I2C communicating with computer. Is this even possible?

Thanks

2015-10-19 13:16:22 -0500 commented question razor_imu_9dof dies

I got it working now. I did have the special firmware installed and could see the results on arduino serial. I ended up downloading all the razor files again and running the firmware from the new download. Arduino serial no longer shows results but the 3D Visualization Test GUI now works.

Thanks

2015-10-13 10:32:58 -0500 answered a question razor_imu_9dof dies

KM6VV- Have you been able to figure this issues out? I have the same problem and it doesn't appear that you got much help here. I assume you are using an FTDI serial to USB adapter with your razor card.

Thanks.

2015-09-29 21:02:53 -0500 commented answer Trouble running robot_upstart

I must have miss understood what robot_upstart actually does. Would this be correct. robot_upstart simply starts up during boot up and points to a folder in the ROS workspace (I assume catkin_ws/src or similar) where it expects to see 1 or many launch file. It than runs these launch files.

2015-09-29 12:49:48 -0500 received badge  Enthusiast