Hot answers tagged

7

It would be nice if we could tell the compiler the range and precision of each fixed-point input variable (perhaps no two having the radix point in the same location), and it would automagically -- at compile time -- use the correct range and precision and rescaling operations for the intermediate values and final values in a series of calculations. I've ...


6

The short answer is yes, but the long answer is that you're approaching the code the wrong way and will need to rewrite things a bit. It looks like you're attempting to read a button and have it flash some LEDs while at the same time having your stepper move back and forth. The problem is your delay(5); commands, which pause the execution of your code. ...


5

Chris is right, the problem is that the mechanical contact of the switch is bouncing. However, I disagree with his statement that the most elegant solution is polling. Polling is very inefficient for the task of counting how many times a button was pressed, and so I decided to post my own answer for clarification: Interrupts are what you want. Polling is ...


4

Robotics is a mixture of things like mechanical engineering, electronics engineering and software engineering! Knowing C++ is a big head start in this area! Because I strongly believe that amongst all three engineering categories software is the one thing you will spend the most time on when developing an autonomous robot. So to start, learn computer-aided ...


3

"All I need to do".... Famous last words. This is a very complicated project to attempt for multiple reasons. I'll try to break down these challenges. For documentation, the datasheet has all the information that you need, but there is probably not any code available that is ready to use. Sparkfun has recently introduced a 'degree of difficulty' rating for ...


3

What your experiencing is known as "button bounce". When you push a standard pushbutton, it actually makes and breaks contact many times very quickly for a few microseconds, usually enough to make the processor detect between 10 and 100 pushes, or more. There are many different methods of "debouncing" a pushbutton. The easiest approach is to add a small ...


3

If you are already using Qt, then Q3 3D would be an obviuos choice for 3D representations. Gaming engines like Unity (C#/JavaScript) or the Unreal Engine (C++) are also a suitable choice for representing robots in 3D. You will find plenty of exmples like this. Using directly OpenGL is also an option, but if you want anything else then just simple 3D ...


3

There are a few dimensions to being a roboticist: is knowledge of theory about robot perception (understanding the world through sensors such as cameras, signal processing and machine learning), planning(how the robot should move) and action (how things move in space, kinematics, dynamics, control theory, reinforcement learning etc.). There are a lot of ...


2

It is not possible to use the micro-controller directly as an H-Bridge. A micro-controller is a micro-controller and an H-bridge is an H-bridge. You need both of them to control a motor (or something equivalent). I will suppose that you are using motors and not servo. Let's say you want to use your micro-controller as an H-bridge. You have two cables from ...


2

I think you should look into the Arduino's attachInterrupt function. You would connect the buttons to a specific interrupt pin on the Arduino and then write a small simple interrupt handler that would be called when that interrupt fires. You can configure the interrupt to fire while low, on a rising edge, on a falling edge, or on a change of the interrupt ...


2

I was having the same problem. I finally solved the problem. This document says that you have to put CR LF (\r\n) characters after you send something in AT mode. But in the arduino code that you use, uses the Serial.write command to send command. But Serial.write command doesn't put CR LF characters. So I used Tera Term to send command. First connect PIN34 ...


2

I've used the TI IQMath Library to implement virtual floating-point on their fixed-point DSPs. Texas Instruments TMS320C28x IQmath Library is collection of highly optimized and high precision mathematical functions for C/C++ programmers to seamlessly port a floating-point algorithm into fixed point code on TMS320C28x devices. These routines are ...


2

It looks like the reason (one of) why the motor stops is due to the following code:- if (buttonState == LOW) { digitalWrite(startScan, HIGH); } else (buttonState == HIGH); --> this is a statement due to the semicolon. { digitalWrite(startScan, LOW); --> this statement will get executed even when buttonState is LOW. }...


2

You need to store the previous value somewhere, e.g. in a static: void ... { static int previous_value = 0; int current_value = Sensor1; diff = current_value - previous_value; previous_value = current_value ... }


2

Ravi - This is a great question. So many great ideas stop simply because we don't know how to kick things off. I'll try to list a few options below for each of your questions so I don't sound like I'm selling one method or product. Your question is at a very high level, so I'll try to point you to some great resources; if I went too deep, I'd have a novel ...


2

For visualization and kinematics, Gazebo works fine. You can use C++ or Python to work with it. There is lots of integration with ROS as well if you like that sort of thing. If you want a clean and simple rigid body dynamics library, I really like RBDL, but you'll need to add your own integrator for simulation and graphics for visualization. odeint works ...


2

Your goal is a bit unclear. In the sense that you don't really care about your motor control input, what you want is a given rotational velocity. the pid is going to give you the command (motor input) to achieve it given the desired one and the current one (plus derivative). Most likely this command is going to be a PWM signal which will be fed to a motor ...


2

Welcome to Robotics, Bloopie Bloops! You haven't stated what platform/language this is, so I'll just give some illustrative pseudo code. As Mark Booth mentioned, the typical way to evaluate/critique controller performance is by plotting the reference and output values together. There are several glaring issues with your code, so I'll go over those. You're ...


1

As the comments indicate, the answer is really based on what you want to do with the programs you write. There are a lot of benefits to the object oriented capabilities of C++. But the inheritance, overloading, etc., does come with a performance penalty. C++ compilers optimize quite well, and for most tasks you will be fine with that - especially since ...


1

Perhaps try UART3? UART2 might be in use for something else as the manual says, "By default the USART2 communication between the target MCU and ST-LINK MCU is enabled..." on page 23, section 5.8. Manual for reference


1

(This really should be a comment, but I don't have enough reputation to comment, my apologies) I'm not very familiar with this "HAL" version of ST's library, but how I normally do timers with STM32 is the following: void TIM2_IRQHandler() { if (TIM_GetITStatus(TIM2, TIM_IT_CC1) != RESET) { TIM_ClearITPendingBit(TIM2, TIM_IT_CC1); ...


1

I liked your choice for using BBB for your stepper motor driving project. BBB is the best open source hardware currently available to accelerate your stepper motor speed to upto 200Mhz precision which is like 15 Times faster than what we can get from Arduino or 12MHz Microcontroller. I used PyPruss python Library for my PRU based project where I coded my PRU ...


1

So, the calibration code was essentially correct. The problem was in my Makefile dependency code. For previous tests i used a range from 0.5 to 2.5ms and that was clearly too much for this ESC. I tried to decrease the range to 0.8ms - 2.2ms, but my makefile didn't notice the change and kept uploading the old version ... After a clean rebuild the ESC is ...


1

Here is the Basic source code you could start with. Then you can make it more complex: #define INA_2 10 // This is the left forward control of the robot, I defined each pwm pin that is connected to the arduino #define INB_2 11 // This is the left backward control of the motor, e.g set this high and INB_1 high and others low you will do a reverse #...


1

It get solved automatically and that give me clear hint that when i was using 9v 1 Amp adaptor, because of heat Arduino was getting a type of HANGED..but when i powered it with USB cable..it works fine now.


1

A switch does not have a quick low to high or high to low transition, instead something like this. This is called switch bounce. image source: piconix.com Just to add to the answers here. There are two commonly used methods to avoid switch bouncing: Using a capacitor with the switch, called RC debouncing. The capacitor tries to smoothen the transition ...


1

I had problems with this as well using a Pro Micro. Testing with a Mega instead and it worked no problem, using (57600) for Serial and (38400) for Serial1. I did try Serial1 as well as BTSerial with the Pro Micro, to no avail but didn't test with BTSerial on the Mega. There's no pin 11 on the Pro Micro, so I used SoftwareSerial BTSerial(10, 14); For ...


1

There are a number of implementations (no libraries that I'm immediately aware of) of Binary Scaling (aka B-scaling) In this, you keep a mental note (or even better, document the code...) of where the decimal point is, using shifts to move the decimal point up or down. I've used B-scaling in assembler on defence projects, on even the smallest CPUs so can ...


1

You're getting garbage in because the module is running at 9600 baud. In order for the module to operate at 38400 baud, pin 34 must be set high before the module is powered on. It looks like you are trying to set the pin high in Setup(), but it's already too late by then. Edit: I see now that he hardwired pin 34 high and he is getting valid data read back ...


1

I had the same problem, so please try this code but with IDE 1.0.0 and baud rate 38400 in serial monitor: void setup() { Serial1.begin(38400); Serial.begin(38400); } void loop() { if(Serial1.available()) { byte a=Serial1.read(); Serial.write(a); } if(Serial.available()) { byte a=Serial.read(); Serial1.write(a); } }


Only top voted, non community-wiki answers of a minimum length are eligible