how to call arduino codes using topics
the codes are dc motor controller, PID controller, ultrasonic sensor
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
the codes are dc motor controller, PID controller, ultrasonic sensor
If you want to interact with Arduino from ROS you have to do it by serial communication. I think the simplest way is python scripting. I did it a few years ago. I had implement a protocol with SYNC, OP_ID, PARAMETERS and CHECKSUM between the PC (ROS) and Arduino
This was my Python script imports:
...
import rospy
import os
import comm
from datetime import datetime
....
where comm is the python file wich manages communication with arduino board
Here I am reading a message from arduino in my ros node file (this is the arduino objetc: ArdIfc)
...
newMsg = ArdIfc.recv()
if newMsg != None:
if newMsg.mod == comm.MOD_SENSORS:
if newMsg.op == comm.OP_GETCURRENTDIST:
torsoPos = newMsg.param[0]
...
Here I am sending a message to the Arduino from my ros node file
...
rospy.loginfo("Torso-> Stop message.")
msgMotor = comm.Msg(comm.ARDUINO_ID, comm.MOD_MOTORS, comm.OP_STOP_MOTOR, [], 0)
ArdIfc.send(msgMotor)
msgMotor_ack_received = False
...
If you want the code I can send it to you.
best, Fedeico
Sir may i learn how to connect a arduino based Robotic arm with MoveIt
@lagankapoor: comments aren't an appropriate place to ask questions. You should create your own question instead of asking in a comment.
thanks sir check i ask new question today please if you know about that help me
I would recommend taking a look at http://wiki.ros.org/rosserial?distro=... maybe that could work.
Asked: 2017-12-06 09:36:11 -0500
Seen: 219 times
Last updated: Dec 06 '17
rosserial_arduino setup problem
How can I get a unique device path for my Arduino/FTDI device
Problems using avr_bridge, Arduino <-> ROS communication
avr_bridge example code not working with current git version?
Rosserial/Arduino Publishers and Subscribers
High level convenience classes for ros_serial
ROS, MIPS Linux, Open Wrt and Arduino
Welcome! What do you mean by "call arduino codes using topics"? What are you trying to accomplish? Also, please see http://wiki.ros.org/Support#Guideline...